Rock-Paper-Scissors

Dear all,

This is going to be an make-up exercise for quiz-1. Your quiz 1 grade will be maximum of quiz 1 and make-up exam: max(quiz-1, make-up).

Again you will create a game. You can help each other but do not upload the same codes with your friend. It is going to be treated as cheating. I recommend you try to do it by yourself until last day. You can google for Python Rock-Paper-Scissors algorithms from the internet but all will require some specific features for the game. Be careful about the details. Do not copy paste the scripts on the internet.

Game is Rock-Paper-Scissors. I think you are familiar with the rules:

Grading criteria

  • Game must have option as 1-Player and 2-Players. USE the structure given below. Do not delete codes I wrote.
  • If it is played 1-Player then Computer should make random choices between rock, paper and scissors.
  • You should correct the upper and lower cases in the game. So users can either write 'paper' or 'Paper' or 'PAPER'...(IMPORTANT)
  • If it is 1 player write 'Computer Wins' not 'Player 2 Wins'.
  • Try to prevent any possible errors user can make.
In [ ]:
def game(*arg):
    if len(arg) == 1:
        # 1-Player Game
        p1 = arg[0] #player-1's game
        p2 = None # IMPORTANT: replace None with a random choice between rock papers and siccors
    elif len(arg) == 2:
        # 2-Player Game
        p1 = arg[0] #player-1's game
        p2 = arg[1] #player-2's game
    else:
        print('You should give 1 argument for 1-Player and 2 for 2-Players')
        return None # If there are more than 2 arguments than function will stop by `return`
    # Start coding the game from here
    # Start coding the game from here
    # Start coding the game from here

Sample Input and Outputs

Your function must give similar results with these. If it is 1 Player Game than results will be random:

game('Rock')

Tie!

game('Rock')

Player 1 Win!

game('Rock')

Computer Win!

If it is 2 players:

game('Rock','Rock')

Tie!

game('Rock','Paper')

Player 2 Wins!

game('Rock', 'Scissors')

Player 1 Wins!

Good luck!