Microsoft Word - Assignment1_Rock_Paper_Scissors.docx
1. Develop the classic game rock-paper-scissors in Python (100pts)
(a) Introduction
It is a simultaneous game with two players. Each player chooses one of rock, paper or
scissors, without knowing the other one's choice. The rules are: rock beats scissors; scissors
eat paper; and paper beats rock. It is a tie if both players make the same choice.
(b) The Task
Several functions have been defined with clear descriptions of parameters and returns,
which will help you implement the game. Please read the file “Assignment1_Rock_
Paper_Scissors.py” for the details. Your task is to implement those functions in that file.
HumanPlayer 20pts
ComputerPlayer 10pts
Judge 10pts
PrintOutcome 10pts
UpdateGameRecord 10pts
PrintGameRecord 10pts
PlayGame 30pts
There are two players: one player is a human user represented by the function
“HumanPlayer”, and the other player is the function “ComputerPlayer”.
The function HumanPlayer will parse user input from the computer keyboard, and it should
e able to handle random input string from the human user. The human user may also
choose to print the record of the game or quit.
The function “ComputerPlayer” will use a random strategy: select rock/pape
scissors
andomly. You will need to import the package random to use the function randint. See the
document: https:
docs.python.org/3/li
ary
andom.html
The outcome of a game will be determined by the function “Judge” and printed to the
console. The game will be played many rounds until the human user wants to quit.
A list “RecordOfGame” will be used to keep a record of players' choices and outcomes. It
will be updated after two players have made the choices at each round.
(c) Notes
Do not use any global variables (variables outside the functions) because they are evil.
Do not change the definitions of the functions in “Project_Rock_Paper_Scissor.py”
Do not define any new functions because the provided functions are enough for the game.
Read the sample run in the next page carefully. You are free to use any words in the
messages as long as they provide the same information to the user.
Play your game many times to make sure it has no bugs.
(d) Sample Run
Have fun in programming!