This year, we added a second computer programming course at Georgetown Law, for Intermediate students. I will write more about this course (which I am thoroughly enjoying) later, but I said a little about it in this post. For now, I just wanted to share the homework assignment for next week. I owe a special debt of inspiration to contests like this one: rpscontest.com
This contest is not open to outside submissions! Please don’t email me your code!
ICPL RPS I
Intermediate Computer Programming for Lawyers 2018
For class on Wednesday, April 4th, we are going to hold the first ever “Intermediate Computer Programming for Lawyers: Rock, Paper, Scissors” Tournament!!!
The pedagogical goals are (1) teach some introductory object-oriented programming; and (2) have the students write code that can “learn” by studying an opponent’s program’s output.
Tournament Format
-
We will pit computer programs against one another in games of rock-paper-scissors.
-
A pair of programs competing in a match will play 1000 individual games of rock-paper-scissors in rapid succession. This means that a well-designed program may be able to learn its opponent’s style during the 1000 games to gain an edge.
-
In the first round of the tournament, every program will compete in a match against every other program, round-robin-style. Because each human programmer will submit two programs, this means your two programs will compete against one another in round one.
-
In the first round, we will not track winners and losers of matches. Instead, we will keep running tallies of the cumulative number of individual games you have won, lost, and tied against all of your opponents.
-
After the first round, the sixteen programs that have won the most first-round games cumulative will advance to the second round.
-
In the second round, programs will be seeded, March Madness-style, in a tournament bracket, based on the number of games won in the first round.
-
In the second round, we will play tournament-style, 1000-game, head-to-head, knock-out contests. For each matchup, the program that has won more games will advance to face the winner from the other part of the bracket.
-
In either round, in case of ties, the program with more tie games will advance/win/or get the better seed. If that doesn’t break the tie, we will flip a (virtual) coin).
-
I will invite a few “celebrity guests” to submit a pair of programs each.
-
The winner will win a prize to be announced during the competition.
Competition Specification
You must submit TWO Python programs no later than Tuesday, April 3rd, at 5:30 PM to the Canvas assignment.
Your two files must strictly conform to the following rules:
-
Your two files should be named
<firstname>A.py
and<firstname>B.py
. -
Your file must create a class called
rps
. -
At a minimum, your file should have an
__init__
method and a second method called.shoot()
. -
The
.shoot()
method must take as an argument a string. This string will always be"R"
,"P"
,"S"
, or""
. This argument will tell you your current opponent’s very last play. In the first round against an opponent, this argument will be the empty string""
. -
The
shoot()
method must return an"R"
,"P"
, or"S"
representing your current play. -
The code that creates your object and calls
shoot()
won’t tell your object the current won/lost/tied stats. If that matters to your code, you need to keep track of it yourself. If you want to keep track of your current opponent’s past plays, you need to remember that yourself. -
Your code cannot store anything to disk. Every time it faces a new opponent, it will be loaded anew, so you can’t rely on any strategy that remembers matches from earlier rounds.
-
In case you don’t know:
"R"
beats"S"
;"S"
beats"P"
; and"P"
beats"R"
.