Ross Sheppard High School
Computer Programming 20
Student Learning Guide
Revisiting the Paper, Rocks, Scissors Program


  When you have finished this project, you will be able to:
explain why a programmer must think of the user
use the Select statement
use the Case statement
streamline your design and code

describe the following terms:

  • Select
  • Case
  1. Create a new folder called PRS2 on your personal drive.

  2. In the last project, you created a game called Paper, Rock, Scissors. For this assignment, you will be modifying the PRS Program to make it more user friendly.

  3. Copy all of the files from your PRS folder to your PRS2.

  4. Read through the instructions for this project, then write the pseudo-code for the PRS2 program on your Program Documentation form.

  5. From a user's perspective, having to click on the Paper, Rock, or Scissors button, then click the Play button is inconvenient and not the way in which a good program is designed. In other words, a good programmer will make a program as easy to use as possible for the programmer.

  6. The first thing you will do is to change the program so that when the user makes a choice, the computer immediately makes a choice and displays the results.

    In your original program, this work was done by the btnPlay CommandButton. In this revised program, this procedure will be done by the btnPaper, btn Rock, or btnScissors CommandButtons, depending upon the user's choice. This means that the procedure must appear in each of the user choice buttons.


  7. Write the code that will serve the same function as the btnPlay Command Button. Hint: you could copy and paste the necessary code from the btnPlay to each of the CommandButtons btnPaper, btnRock, and btnScissors.

  8. Save the program and try run it to ensure it works.

  9. Because the user will have to make a choice for the program to work, the procedure in the original program that beeped and asked the user to make a choice - and changed the font size - is no longer required.

  10. Delete the following code from the btnPlay_Click():



  11. Delete all of the other code that is no longer required.

  12. Next, go to the View Object view and delete the CommandButton btnPlay because it is no longer required.

  13. Save your program and run it. Does it work?

  14. The next feature you will add to the program is one that keeps track of the number of wins, ties, and losses during a single game.

  15. Switch to the Object View.



  16. Add the following labels:
  17. Set the appropriate properties for each of the Labels.

  18. When the user plays the PRS game, it will display the wins, ties, and losses in the proper Labels. It is important that the program keep track of the current number of wins, ties, and losses, and add any additional wins, ties, and losses to the already existing record.

  19. In the General_Declarations section of the form, add the following variable declarations:
  20. In the CommandButton btnPaper revise the code that displays the status - Tie!, You Win!, or You Lose!:



    The purpose of this code is to fill the variable WTL for the next step of the program.

  21. Add the following code to the CommandButton btnPaper just before the End Sub statement:



  22. The purpose of this code is to find out what the variable is for WTL - that is 1, 2, or 3. Depending on the variable, Visual Basic will increment the Win, Tie, or Loss label by 1.

  23. Add the same code to each of the other two CommandButton choices.

  24. In an effort to create well designed programs without unnecessary objects, delete the CommandButton btnClear object and the code from the form.

  25. The next item to clean up is the displays that inform the user what choice was made and what choice the computer made. Each of these consisted of a label with the caption "Your Choice" and a second TextBox that displayed the name of the choice - Paper, Rock, or Scissors.

  26. You task is to use a single Label or TextBox that displays both pieces of information - one for the user's choice and another for the computer's choice.

  27. Save your work and test the program.

  28. Next, change the location and properties of the objects on the form for the best possible design.

  29. Click here to see the marking guide for this project.

  30. When you are finished, send an email to your teacher asking that this project be marked.


© 1998-2000 N.F. Mathew, EdD
File name: PRS-2.htm
Last updated on October 18, 2000