1 / 11

Rock Paper Scissors

Rock Paper Scissors. Use logic to teach the computer how to play a game. Rock Paper Scissors. Comes from a Japanese game called “ jan -ken”

noe
Download Presentation

Rock Paper Scissors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rock Paper Scissors Use logic to teach the computer how to play a game

  2. Rock Paper Scissors • Comes from a Japanese game called “jan-ken” • It’s a game usually played by two people, where players make one of three shapes with their hands at the same time. The "rock" beats scissors, the "scissors" beat paper and the "paper" beats rock; if both players throw the same shape, the game is tied. http://en.wikipedia.org/wiki/Rock-paper-scissors#Asian_origin

  3. Objective • To complete a Rock Paper Scissors game using BYOB that allows a person to play against the computer. • The game has been started for you on the compsci drive in the Designing Tech folder.

  4. Directions • Start BYOB • Open the RockPaperScissors_YourName file from the Compsci drive in the Designing Tech folder. • Save it to your H: drive with your own name.

  5. Some information • It’s easier for a computer to work with numbers • For this program, the computer will assign a number to each choice • ROCK=0 • PAPER=1 • SCISSORS=2 • To choose the winner you have to compare the computer’s choice with the player’s choice.

  6. Try the program • It’s not finished yet. • Choose J, K or L and see what happens • Is it the same every time? • The only part missing in this program is the code to decide who wins. • That’s your job. This part is missing

  7. How will you decide the winner? Algorithm 1 • If player1 chooses rock.. • If computer chooses rock it’s a tie • If computer chooses scissors, then player 1 wins because rock smashes scissors • If computer chooses paper then computer wins because paper covers rock. Algorithm 2 • If player1 chooses rock and computer chooses rock it’s a tie • If player1 chooses rock and computer chooses scissors, player 1 wins because rock smashes scissors • If player1 chooses rock and computer chooses paper then computer wins because paper covers rock. Can you see how these 2 algorithms are different but they both do the same thing?

  8. What do the conditions look like? Algorithm 1 • If player1 chooses rock.. • If computer chooses rock it’s a tie Algorithm 2 • If player1 chooses rock and computer chooses rock it’s a tie Can you see how these 2 algorithms are different but they both do the same thing? Choose the algorithm that makes the most sense to you.

  9. Answer questions on Edline • Use BYOB and the Rock Paper Scissors program to answer the questions. • If you can’t get into your Edline account, ask the sub for a paper to write your answers on.

  10. Finish the program • Complete the code • It’s in the computer sprite script • Fix the part afterwhen I receivedetermine winner. • Make it say who winsand why Replace this part

  11. Challenge • Add 3 more variables and count: • How many rounds were played • How many times the computer wins • How many times the player wins

More Related