Rock, Paper, Scissors

Similar documents
Girls Programming Network. Scissors Paper Rock!

Create a game in which you have to guide a parrot through scrolling pipes to score points.

In this project you will learn how to write a Python program telling people all about you. Type the following into the window that appears:

Lesson 8 Tic-Tac-Toe (Noughts and Crosses)

Where's the Treasure?

In this project, you ll learn how to create 2 random teams from a list of players. Start by adding a list of players to your program.

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

Part II: Number Guessing Game Part 2. Lab Guessing Game version 2.0

Whack-a-Witch. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

Before displaying an image, the game should wait for a random amount of time.

Introduction to Turtle Art

Unit 5: What s in a List

Determine the Expected value for each die: Red, Blue and Green. Based on your calculations from Question 1, do you think the game is fair?

SPLAT MINECRAFT [ CHAPTER EIGHT ] Create an exciting two-player game in Minecraft: Pi, inspired by Nintendo s hit game game Splatoon ESSENTIALS

In this project you ll learn how to code your own musical instruments!

Let s start by making a pencil, that can be used to draw on the stage.

Rock Band. Introduction. Scratch. In this project you ll learn how to code your own musical instruments! Activity Checklist.

Ghostbusters. Level. Introduction:

Explore and Challenge:

Sudoku Touch. 1-4 players, adult recommended. Sudoku Touch by. Bring your family back together!

1. Click the Create a Tournament Button (see Challonge Screen 01)

MIRROR IMAGING. Author: San Jewry LET S GET STARTED. Level: Beginner+ Download: None Version: 1.5

settinga.html & setcookiesa.php

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Add in a new ghost sprite, and a suitable stage backdrop.

Scratch for Beginners Workbook

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

ChatBot. Introduction. Scratch. You are going to learn how to program your own talking robot! Activity Checklist. Test your Project.

SAVING, LOADING AND REUSING LAYER STYLES

Welcome to Weebly. Setting up Your Website. Write your username here:

Welcome to 6 Trait Power Write!

Fireworks. Level. Introduction: In this project, we ll create a fireworks display over a city. Activity Checklist Follow these INSTRUCTIONS one by one

Welcome to. Student Passport Getting Started

LEVEL A: SCOPE AND SEQUENCE

Making an application on UCAS Progress via Kentchoices

Some code for this game has been provided for you. Open this trinket: This is a very basic RPG game that only has 2 rooms. Here s a map of the game:

Defend Hong Kong s Technocore

Italian Box Virginal

Brain Game. Introduction. Scratch

Pong! The oldest commercially available game in history

INVENTION LOG FOR CODE KIT

- Introduction - Minecraft Pi Edition. - Introduction - What you will need. - Introduction - Running Minecraft

AIM OF THE GAME GLACIER RACE. Glacier Race. Ben Gems: 20. Laura Gems: 13

Defend Hong Kong s Technocore

CONCEPTS EXPLAINED CONCEPTS (IN ORDER)

Creating Computer Games

Times Tables. Games and strategies to help your child learn their times tables.

Flappy Parrot Level 2

Lesson 2 Game Basics

Sheepshead, THE Game Set Up

In this project we ll make our own version of the highly popular mobile game Flappy Bird. This project requires Scratch 2.0.

Programming with Scratch

Learning & Development

Girls Programming Network. Sassy Security Chatbots! Extensions!

Requirements Specification

Audacity 5EBI Manual

COMPUTING CURRICULUM TOOLKIT

Personalize Your Napkins

This Photoshop Tutorial 2012 Steve Patterson, Photoshop Essentials.com. Not To Be Reproduced Or Redistributed Without Permission.

Game 0: One Pile, Last Chip Loses

Introduction to Computer Science with MakeCode for Minecraft

It was late at night and Smartie the penguin was WIDE awake He was too excited to sleep because tomorrow was his birthday. He was really hoping to be

Step 1. - To Create an Account

Tech Tips from Mr G Borrowing ebooks and Audiobooks Using OverDrive 3.2 on Android Devices, Including the Kindle Fire

Worksheet CODE YOUR DANCE. Part 1: Create a Dance Algorithm

CHM 152 Lab 1: Plotting with Excel updated: May 2011

Chapter 16 Insteon Visual Scene Editor (VSE)

PLAY & WIN!* SUPER RUGBY 2018 DOWNLOAD THE APP TODAY! See inside for more information. *Terms and conditions apply. Metalcraft Insulated Panel Systems

Ok, we need the computer to generate random numbers. Just add this code inside your main method so you have this:

Sanctioning A Tournament

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

Fairytale Legends: Hansel and Gretel Game Rules

By Night Studios: Basic Combat System Overview

In the main game there are 3 features which are randomly activated: Legend Spins, the Appetite for Destruction Wild, and the Solo multiplier.

Your Guide to becoming a Master Spy

Using Cypress Resume. To access Cypress Resume visit your library s website:

Lesson 15: Graphics. Introducing Computer Graphics. Computer Programming is Fun! Pixels. Coordinates

ORDERING YOUR dōterra

Let's Race! Typing on the Home Row

Wild. Overlay Wild. Bonus Game. Football: Champions Cup Game Rules

Educational Technology Lab

Robotic Manipulation Lab 1: Getting Acquainted with the Denso Robot Arms Fall 2010

Congratulations - Welcome to the easiest way to make money online!

Sudoku Tutor 1.0 User Manual

EconS Game Theory - Part 1

An Adaptive-Learning Analysis of the Dice Game Hog Rounds

Math 152: Applicable Mathematics and Computing

Tech Tips from Mr G Borrowing ebooks and Audiobooks Using OverDrive 3.2 on Apple ios Devices 2015

Create a "Whac-a-Block" game in Minecraft

Would You Like To Earn $1000 s With The Click Of A Button?

Pong! The oldest commercially available game in history

How does Blogging work?

Warlords - Crystals of Power Game Rules. Random Overlay Wild. Scatter

Jimi Hendrix Online Slot Game Rules

In this project, you ll design and code improvements to a 2D version of Minecraft.

Cutting out in GIMP. Navigation click to go to a section

Chose from One or More of the Following Options:

Transcription:

Projects Rock, Paper, Scissors Create your own 'Rock, Paper Scissors' game. Python Step 1 Introduction In this project you will make a Rock, Paper, Scissors game and play against the computer. Rules: You and the computer both choose rock, paper or scissors. The winner is decided by these rules: Rock blunts scissors Paper covers rock Scissors cut paper Step 2 Player s Turn First, let the player choose Rock, Paper or Scissors. Open this trinket: jumpto.cc/rps-go (http://jumpto.cc/rps-go). The project already contains the code to import a function that you are going to use in this project.

You ll use randint later to generate random numbers. First, let the player choose Rock, Paper or Scissors by typing the letter r, p or s. Now print out what the player chose: Test your code by clicking Run. Click in the trinket output window and enter your choice. Step 3 Computer s Turn Now it s the computer s turn. You can use the randint function to generate a random number to decide between rock, paper and scissors. Use randint to generate a random number to decide whether the computer has chosen rock, paper or scissors. Run your script lots of times (you ll need to enter r, p or s each time.) You should see that chosen is randomly set to either 1, 2 or 3. Let s say: 1 = rock (r) 2 = paper (p) 3 = scissors (s)

Use if to check if the chosen number is 1 ( == is used to see if 2 things are the same). Python uses indentation (moving the code to the right) to show which code is inside the if. You can either use two spaces (tap the spacebar twice) or tap the tab key (usually above CAPSLOCK on the keyboard.) Set computer to r inside the if using indentation: You can add an alternative check using elif (short for else if): This condition will only be checked if the rst condition fails (if the computer didn t choose 1 ) And nally, if the computer didn t choose 1 or 2 then it must have chosen 3. This time we can just use else which means otherwise.

Now, instead of printing out the random number that the computer chose you can print the letter. You can either delete the line print(chosen), or make the computer ignore it by adding a # at the start of the line. Test your code by clicking Run and choosing your option. Hmm, the computer s choice gets printed on a new line. You can x that by adding end=' ' after vs, that tells Python to end with a space instead of a new line. Play the game a few times by clicking Run and making a choice. For now you ll have to work out who won yourself. Next you ll add the Python code to work this out. Step 4 Check the Result Now let s add the code to see who won. You need to compare the player and computer variables to see who won. If they re the same then it s a draw: Test your code by playing the game a few times until you get a draw. You ll need to click Run to start a new game. Now let s look at the cases where the player chose r (rock) but the computer didn t.

If the computer chose s (scissors) then the player wins (rock beats scissors). If the computer chose p (paper) then the computer wins (paper beats rock). We can check the player choice and the computer choice using and. Next let s look at the cases where the player chose p (paper) but the computer didn t: And nally, can you add the code to check for the winner when the player chose s (scissors) and the computer chose rock or paper? Now play the game to test your code. Click Run to start a new game. Step 5 Challenge: ASCII Art Instead of using the letters r, p and s to represent rock, paper and scissors, can you use ASCII art?

For example: Where: rock: O paper: scissors: >8 Hints: Instead of saying print computer you ll need to add a new line to each of the options in the if to print out the correct ASCII art. Instead of saying print player you ll need to add a new if statement to check which item the player chose and print out the correct ASCII art: Hint: Remember that adding end=' ' to the end of a print makes it end with a space instead of a new line. Step 6 Challenge: Create a new game Can you create your own game like Rock, Paper, Scissors with di erent objects?

Click the Duplicate button to make a copy of your Rock, Paper Scissors project to start from. This example uses Fire, Logs and Water: Published by Raspberry Pi Foundation (https://www.raspberrypi.org) under a Creative Commons license (https://creativecommons.org/licenses/by-sa/4.0/). View project & license on GitHub (https://github.com/raspberrypilearning/rock-paper-scissors)