top of page

Rock-Paper-Scissors

Feb 26, 2018
2 min read

So last week in my computing class, as homework we were tasked to create rock paper scissors

Task:

Create a game of rock-paper-scissors

  • Including:

  • Ability to play again

  • Play against the computer

  • Validation on users entry

Struggles:

I struggled with trying to get the game to restart after each round. i.e. When each round is complete, I had to make sure that the user choices reset, a new random number was generated each round for the computers selection. Also when the game is finished, giving the user the option to replay the game or exit, replaying the game meant setting all the previous setting back to how it was when it initiated, such as scores back to 0, reseting the amount of games they want to play

Final Outcome:

I managed to make a fully functional version of RPS, through the user of a GUI that I customised.

The game initialises with a dialog box allowing the user to input the number of rounds it wants to play against the computer.

The user can select one of 3 buttons, with images, only one button can be activated at a time and so I had to make sure that when I was coding it, that when a button was pressed, I linked it to a boolean variable and enabled it true, and therefore enabling the other two buttons false.

The user has to validate their selection, this then starts the rest of the code. Once they have validated their selection using the dialog box, the program will randomly select the computers choice using random numbers and will compare this to the selection made by the user, this will then show the results in a dialog box.

This will loop until you have played the final round, and then it will output the final scores at the end, after, the user will be given the option to play again, if yes, they will be asked how many round and it will loop again. If they select no, then the app will close.

  • Initial Screen
  • Input amount of games
  • How each round starts
  • Selecting
  • Validate Selection
  • Computer Wins
  • User Wins
  • Final Score
  • Option to play again

Comments


Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Black LinkedIn Icon
  • Black Google+ Icon
bottom of page