You must design a small console-based rock-paper-scissors game (also called roshambo). The rules of this game are available on Wikipedia.
The deadline is Saturday March 15th at 11:55pm.
The program MUST run (when opened in IDLE, and executed using F5, it must not cause an error from the get go), or the grade will be an automatic zero.
Teams are encouraged, but at most three people by team. If the teams contain people with very different grades, the person with the lesser grades might be asked to provide some explanations on the working of the code.
Coursys will allow for the creation of groups (I have no idea how this feature works so don't ask me). When you name the group, don't invent anything crazy, simply list the SFU ID of the students in the group.
The assignment consists of one Python source code on Coursys (eventually, if you attempt one of the advanced tasks, you might need to submit a second file - for instance if you write a second code file for the simulations; only in this case may you submit a second file).
The main Python source code file must begin with the lines:
################################################ ### ROCK PAPER SCISSORS (CMPT 120 Assignment #1) ### Date: ... ### Team (name and SFU ID): ### - ... ################################################ ### Advanced tasks: ### - ... ################################################
For instance:
################################################ ### ROCK PAPER SCISSORS (CMPT 120 Assignment #1) ### Date: March 1st 2014 ### Team (name and SFU ID): ### - Jeremie Lumbroso (jlumbroso) ### - Peggy Wen (peggyw) ### - Seymour Hoffman (seyhoff) ################################################ ### Advanced tasks: ### - additional weapons (well) ### - predict next move based on previous move ################################################
The main tasks will allow a team to get full marks for this assignment. The advanced tasks should only be undertaken by students with a quiz 1 score beyond 6.50; and it is mandatory for students with a quiz 1 score of 10.00 to complete at least one advanced task.
Questions should be asked on the help list: cmpt-120-help@sfu.ca.
It is highly recommended that you use the template.py file as a starting point, and the following questions as a guide. However you are allowed to go another route if you believe you can do better (it will however be harder to give you partial marks if your program does not work and you do not follow the template).
Here is a possible way of going about this assignment:
Using print statements, complete the welcome_prompt() function, which should display some introduction text presenting the name of the game, the authors of the program, and the rules of the game.
For instance, at the bottom of this subsection, you can see examples of my version of the game, to give you an idea of what is expected; you do not need to copy my text as it is: use your imagination and have fun!
Complete the function get_player_move(), to ask the player to input a move; translate the input so that the function returns 1 for rock, 2 for paper and 3 for scissors. If the player inputs an incorrect move, have him try again, until the move is valid.
This question closely follows the functions ask_number() (asked as question in lab 5) and ask_bool() (given in lecture 14).
Complete the function get_computer_move() which draws a random integer between 1 and 3 (both included), prints a message indicating which move the computer has done (still 1 for rock, 2 for paper, 3 for scissors), and then returns the move.
Complete the function compare_moves(playermove, compmove) which takes two moves (integers between 1 and 3) and determines whether the player or the computer has won, or whether there is a tie. The function must return -1 if the computer won, 1 if the player won, and 0 if there is a tie.
Test all your functions to make sure they work!!
In the top level (that means outside of the functions, at the bottom of the file), write a program that uses the previously written functions to make the game itself:
For students with a grade less than 6.50, any advanced task will count as bonus points. For students with a grade of 10.00 on Quiz 1, it is mandatory to pick at least one advanced task (and any additional task will be counted as bonus points).
Pick any of the following, and you may pick several:
Make simulations and present them. For instance, copy your code, and replace the player move with:
Are any of these functions better at winning than another?
At current, the computer makes completely random moves, which may not always be the best strategy. Try to improve the winning strategy by using any sort of more intelligent strategy, that for instance might remember the previous move or previous moves of the opponent (for instance, if you won with rock at one round, the opponent might have a greater chance of playing paper the next round to anticipate that you might play rock again, so you could play scissors). See this game at the NY Times for ideas, or the subsection on Wikipedia.
Note: do not try to make something too complicated, even a mild improvement or simple idea (remembering one move, for instance) will get full grade for this task.
Make it so the program can run in two different languages, with the language choice selected at the beginning.
Any additional idea to make this more interesting is welcome... as long as you think of it on your own!