Professional Documents
Culture Documents
Mini-Project Description - Rock-paper-scissors-lizard-Spock
Mini-Project Description - Rock-paper-scissors-lizard-Spock
Rock-paper-scissors is a hand game that is played by two people. The players count to three in unison
and simultaneously “throw” one of three hand signals that correspond to rock, paper or scissors. The
winner is determined by the rules:
Rock-paper-scissors is a surprisingly popular game that many people play seriously (see the Wikipedia
article (http://en.wikipedia.org/wiki/Rock_paper_scissors) for details). Due to the fact that a tie happens
around 1/3 of the time, several variants of Rock-Paper-Scissors exist that include more choices to make
ties more unlikely.
In our first mini-project, we will build a Python function rpsls(name) that takes as input the string name,
which is one of "rock", "paper", "scissors", "lizard", or "Spock". The function then simulates playing a
round of Rock-paper-scissors-lizard-Spock by generating its own random choice from these alternatives
and then determining the winner using a simple rule that we will next describe.
While Rock-paper-scissor-lizard-Spock has a set of ten rules that logically determine who wins a round of
RPSLS, coding up these rules would require a large number (5x5=25) of if/ elif/ else clauses in your mini-
project code. A simpler method for determining the winner is to assign each of the five choices a
number:
0 — rock
1 — Spock
2 — paper
3 — lizard
4 — scissors
In this expanded list, each choice wins against the preceding two choices and loses against the following
two choices. In all of the mini-projects for this class, I will provide a walk through of the steps involved in
building your project to aid its development. A template for your mini-project is available at
(http://www.codeskulptor.org/#examples-rpsls_template.py). Please work from this template.
The output of running your program should have the following form:
Player chooses rock
Computer chooses scissors
Player wins!
Note that, for this initial mini-project, we will focus only on testing whether your implementation of
rpsls() works correctly on valid input.
2 pts — A valid CodeSkulptor URL was submitted. Give no credit if solution code was pasted into the
submission field. Give 1 pt if an invalid CodeSkulptor URL was submitted.
2 pts — Program implements the function rpsls() and the helper functions name_to_number() with
plausible code. Give partial credit of 1 pt if only the function rpsls() has plausible code.
2 pts — Program prints "Player chooses player_guess" where player_guess is a string of the form "rock",
"paper", "scissors", "lizard" or "Spock". Give 1 pt if program prints out number instead of string.
2 pts — Program prints "Computer chooses computer_guess" where computer_guess is a string of the
form "rock", "paper", "scissors", "lizard" or "Spock". Give 1 pt if program prints out number instead of
string.
1 pt — Computer's guesses vary between five calls to rpsls() in each run of the program.
3 pts — Program prints either "Player and computer tie!", "Player wins!" or "Computer wins!" to report
outcome. (1 pt for each message.)
3 pts — Program chooses correct winner according to RPSLS rules. Please manually examine 5 cases for
correctness. If all five cases are correct, award 3 pts; four cases correct award 2 pts; one to three cases
correct award 1 pt; no cases correct award 0 pts.