1. Engineering
  2. Computer Science
  3. problem you are asked to implement a textbased game to...

Question: problem you are asked to implement a textbased game to...

Question details

PROBLEM You are asked to implement a text-based game to guess a hidden rule by inputting a sequence of three integer numbers A demo of the guessing game is shown irn http://www.nytimes.com/interactive/2015/07/03/upshot/a-quick-puzzle-to-test-your problem-solving Detailed Requirement: This game plays off of a simple cognitive bias called the confirmation bias. People are predisposed to look for information that confirms their beliefs. If you believe the rule is something like each number is twice as large as the last number you are going to make guesses that confirm your belief. Each positive answer will further reinforce your belief In science, we need to check our hypotheses by attempting to falsify them, or prove them wrong. We need to attempt to disprove the rule, by checking sequences that dont follow our hypothesized rule. Your task is to recreate this game in C++, albeit in a simpler, text-based format. The player enters sequences of three numbers to see if they follow the hidden rule. When the player has entered his or her sequence, the program should reply whether or not the sequence followed the rule. You can use the same rule as in the demo or create your own. Regardless the game is played the same way. Create a loop which gives the player instructions on what to input. Then read input from the player. The input will be either one of three options » If the user enters the word answer or some other string you choose to indicate the player is ready to end the game and guess In this case, output the hidden rule » Three numbers separated by spaces Lets call a trio of numbers and the corresponding output a Guess. Once a user makes a Guess If the user enters a sequence that follows the rules, outputYes! Otherwise output No Treat any other entry as an exception.Sample Result: Please input three numbers (three integers separated by spaces or enter answer to get the rule) NO Please input three numbers (three integers separated by spaces or enter answer to get the rule) 2 3 5 YES Please input three numbers (three integers separated by spaces or enter answer to get the rule) 2 3 6 YES Please input three numbers (three integers separated by spaces or enter answer to get the rule) 2 5 4 NO Please input three numbers (three integers separated by spaces or enter answer to get the rule) rule invalid input Please input three numbers (three integers separated by spaces or enter answer to get the rule) answer the role is increasing RUN FINISHED; exit value0; real time: 25s; user: 0ms; system: Oms

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution