Design of Rock-Paper-Scissors end Print instructions Play game Ask user If (s)he wants to play again Play again? Y Print stats: wins, losses and ties start.

Slides:



Advertisements
Similar presentations
Eggs, Chickens, and Dinosaurs
Advertisements

Permutations and Combinations
MATLAB Examples. CS 1112 MATLAB Examples Find the number of positive numbers in a vector x = input( 'Enter a vector: ' ); count = 0; for ii = 1:length(x),
Computers playing games. One-player games Puzzle: Place 8 queens on a chess board so that no two queens attack each other (i.e. on the same row, same.
Computer Programming Lab 8.
ACMSP116 & ACMSP144 List outcomes of chance experiments involving equally likely outcomes and represent probabilities of those outcomes using fractions,
Introduction to Game theory Presented by: George Fortetsanakis.
Lectures 7&8 Revisit Elections Now range is left-wing or right-wing politics. Candidate-Voter model Assume even distribution of voters. Voters will vote.
Tonight’s JavaScript Topics 1 Conditional Statements: if and switch The Array Object Looping Statements: for, while and do-while.
PLANNING THE TIC TAC TOE GAME BY NEEL DAVE. TIC TAC TOE INSTRUCTIONS Tic Tac Toe Instructions The basic concept of Tic Tac Toe 1.This is a game for two.
Tic Tac Toe Architecture CSE 5290 – Artificial Intelligence 06/13/2011 Christopher Hepler.
Probability Review. Vocabulary Probability: the chance of an event happening or occurring. Theoretical Probability: It is the chances of an event happening.
Problem 5.31 Ryan H Kian L Jun Oh Y Starting Out:  Define a Round Robin Tournament:  A tournament in which each player plays every other player. There.
Use logic to teach the computer how to play a game
 for loop  while loop  do while loop  How to choose?  Nested loop  practice.
Orange Boat 3Purple Boat 4Red Boat 5Yellow Boat 6Green Boat 2Blue Boat 1.
COMP 14 Introduction to Programming Mr. Joshua Stough February 16, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
Main task -write me a program
1 Lab Session-7 CSIT-121 Fall Introducing Structured Choice 4 The do~While Loop 4 Lab Exercises.
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
HANGMAN Created By: Will Matthau & Christian Stumpf.
9/14/20151 Game Theory and Game Balance CIS 487/587 Bruce R. Maxim UM-Dearborn.
Multiplication Mania Let’s practice your multiplication facts.
©Robomatter – Distribution or copying without permission is prohibited. 3B STEM Computer Science 1 ©Robomatter – Distribution or copying without permission.
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Parts of a Computer Game for 2 nd & 3rd grade Speakers Equipment attached to the computer to play sound.
Game Theory Explains Perplexing Evolutionary Stable Strategy Erin N. Bodine Math 188: Social Choice & Decision Making 22 – April Side Blotch Lizards.
Methods Version 1.1. Topics Built-in methods Methods that return a value void methods Random number generators Programmer defined methods Scope.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
Discussion 4. Labs public MyPoint(double xInit, double yInit ) { MyPoint p = new MyPoint(0, 0); } ClassProblem.java recursive java.lang.StackOverflowError.
SD1230 Unit 6 Desktop Applications. Course Objectives During this unit, we will cover the following course objectives: – Identify the characteristics.
UFCEKS-20-2Multimedia Authoring Times Table Quiz.
Wedding Games Sometimes, to prevent the guests who attend the wedding will feel boring, there are some wedding games usually held in Taiwan. Group 8 JimmyBiancaHenry.
Conditional Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
String X=“Python Rocks!” X.index(“O”).
MarioAI Level Generation Track. COMPETITION GOALS  Create an automatic level generator for Infinite Mario Bros.  Levels should be randomly generated.
Logical Operators, Boolean Variables, Random Numbers This template was just too good to let go in one day!
Random UNPREDICTABLE NUMBERS. A FEW APPLICATIONS THAT USE RANDOM…. Predictions for life expectance used in insurance Business simulations Games (Give.
Methods Version 1.1. Topics Built-in methods Methods that return a value Methods that do not return a value (void methods) Random number generators Programmer.
Parts of a Computer. Two Basic Components of a Computer System Hardware Parts of the Computer System you can physically touch Software Computer Instructions.
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Times Table Quiz This will contribute towards your online portfolio for this module.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
File Processing Recap. String Processing: Review Escape Sequences: print the unprintable '\ ' : escape sequence '\n' : newline '\t' : tab '\"' : " >>>
Designing Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Balanced Unbalanced The Goal “Perfectly Imbalanced”
Do Now: March 28th A box contains a large number of plastic balls. Some of the balls are red and the rest are green. One ball will be selected at random.
I’m fine.I’m great!I’m very good. I’m not good. I’m tired.I’m hungry!
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Chapter 6 Functions The Tic-Tac-Toe Game. Chapter Content In this chapter you will learn to do the following: 0 Write your own functions 0 Accept values.
YOU COMUTER WANT TO PLAY NOUGHTS AND CROSSES WELL NOW YOU CAN! JUST CLICK ON THE PLAY BUTTON BELOW AND YOU CAN BEGIN IF WINNER APPEARS BELOW CLICK ON IT.
More on Functions (Part 2)
Allocation Strategies
Writing Functions( ) (Part 5)
Pick a number, any number …
VISUAL BASIC FINAL PROGRAMMING PROJECT
VISUAL BASIC FINAL PROGRAMMING PROJECT GRADE SHEET
Higher Computing Using Loops.
Exploring Computer Science Lesson 4-11
More on Functions (Part 2)
Big problem  small steps
The first number is posted telling what random number was selected, I did this for testing purposes, in the real thing it would not be there. Since the.
Connect 4.
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
Functions MIS 3406 Department of MIS Fox School of Business
Make a Tail Game “꼬리 만들기” 놀이.
Pseudo-Code Conditional Branches
Tic-Tac-Toe Game Engine
Facial Hair.
GCSE Computing.
Presentation transcript:

Design of Rock-Paper-Scissors end Print instructions Play game Ask user If (s)he wants to play again Play again? Y Print stats: wins, losses and ties start N

Play game start Read and validate user choice Generate computer’s choice Determine winner Print winner Update stats end

Read and validate user choice end start Prompt user to enter choice Read user choice from keyboard User choice is rock, paper or scissors? NY

Generate computer choice start Generate a random number between 0 and 2, where 0 corresponds to ROCK, 1 corresponds to PAPER, and 2 corresponds to SCISSORS. end

Determine winner start end User choice is same as computer choice? User choice is ROCK and computer choice is SCISSORS OR User choice is SCISSORS and computer choice is PAPER OR User choice is PAPER and computer choice is ROCK ? Result is tie Result is: win for user Result is: loss for user Y N Y N

Update stats start end Result is tie?Result is win for user? ties++ wins++losses++ Y N Y N

Methods (subtasks) Print instructions Play game –readAndValidateUserChoice –generateComputerChoice –determineWinner –updateStats

Methods (continued) NeedsReturns printInstructionsNone readAndValidateUserChoiceNoneValidated user choice generateCompChoiceNoneComputer choice determineWinnerUser choice and computer choice Result of game updateStatsResult of game None (updates wins/losses/ties)

Methods (updated) NeedsReturns getInstructionsNoneString readAndValidateUserChoiceNoneValidated user choice generateCompChoiceNoneComputer choice determineWinnerUser choice and computer choice Result of game updateStatsResult of game None (updates wins/losses/ties)