To expand further we want to try out logic in interacting


Rock, Paper, Scissors
Description:
To expand further, we want to try out logic in interacting with users. Here is a sample of a game, using loops and decisions to allow a person to play rock-paper-scissors with a computer.
Pseudocode
We have a helper function that we will use here that tells us who won. It will result in +1 if the player wins, a -1 if the computer wins, and a 0 if it is a tie.
function compareOutcome(computerMove: Integer, 
playerChoice : Integer) returns Integer
And the main flow of our logic is as such.
while (true)
Integer : computerChoice = randomChooser()
Integer : playerEntry = prompt user to enter a value
If (playerEntry is not a valid input)
Prompt user they have picked a bad number and try again
Else
Integer : outcome = compareOutcome(computerMove, playerEntry)
If (outcome = 0)
Prompt user it is a tie, and try again
Else if (outcome = -1)
Prompt user they lost
Break out of loop
Else
Prompt user they won
Break out of loop
End if
End if
end loop
Flowchart


Note: In this case, note the advantages and disadvantages of flowcharts and pseudocode. The flowchart is easy to follow the logic for one scenario, but does it make it easier or harder to understand the code as a whole? There is no strict answer, but one that tells you a bit about your way of thinking and personal preference.
Interaction Scenario
For either of the solutions above, follow the logic and map out your interaction step-by-step, trying to exercise all paths of the logic. You will have to take at least 2 times through the game to map all scenarios.
Scenario 1
Step User Input System Response
1 User chooses 50 System says lower
2 ... ..


Scenario 2
Step User Input System Response





(copy and add more if needed/desired)
Number Guessing Game
Description
Now it is your turn to try out user interaction with a simple game. This goes back to the number guessing game. The user will input a number each time, say between 1 and 100. The computer will randomly select 1 number each game (note this is different than the example above where it selects a new answer each round), and the game continues until the user guesses the right number. 
Like above, your solution should accommodate for invalid input, but do not worry about how to make that logic work for now. Your solution should give some hints though if the guess the user made was too high or too low, to help them on their way.
Flowchart

Pseudocodeour solution here> 

Request for Solution File

Ask an Expert for Answer!!
Electrical Engineering: To expand further we want to try out logic in interacting
Reference No:- TGS01266432

Expected delivery within 24 Hours