RPS class

m

Use Cases

r

Describe what the user does and sees from the computer0) computer displays welcome message1) play game 1) computer prompts user for a choice 2) user makes choice 3) computer displays the computer's choice 4) display the result

results

draw

User wins

user loses

bad input

user input/throw

rock

paper

scissors

Members

Methods

constructor

play game

r

* input - player's choice* return the result(win,lose,tie)* need to know the computer's choice? * option 1 - use a property * option 2 - out/ref parameterRPSChoice computerChoice;RPSResult rpsResult = rpsGame.Play(playerChoice, out computerChoice);string txtComputerChoice = computerChoice.ToString();

play again

throw

Properties

userChoice

computerChoice

Toolbox

random number generator

enumerator for choices

rock

paper

scissors

get user's choice

Play it again Sam!

user enters number of games to play

escape key

r

utilize a sentinel value that when entered exits the loopie: using 1,2,3 or r,p,s for throw, use 0 or x as a sentinel to exit?what do we do with any other keys??data validation?RPSChoice userChoice;while ( (userChoice = GetUserChoice()) != RPSChoice.exit )OR// priming "read"RPSChoice userChoice = GetUserChoice();while ( userChoice != RPSChoice.exit ){ // do stuff userChoice = GetUserChoice();}orspecific continue or not prompt

Subtopic

Gaming Program

m