Draw a flowchart of the algorithm calculating how many steps the player can guess a 4-digit number randomly generated by the system
Draw a flowchart of the
Your algorithm is expected to print TIP information about the number predicted in each round.
About the Game: You are expected to design a single-player summer-draw game. It is a game based on the user guessing the random number generated by the system. The first digit of the generated number cannot be zero and the same digit can only be found once in the number (It should be assumed that the RANDOMLY GENERATED NUMBER was produced in accordance with this RULE. There is no need for any control process.).
The number of digits in both the generated number and the predicted number and in the same digit (that is, the correct place) is expressed as PLUS; The number of digits in both but in different digits (incorrect location) is expressed as MINUS.
For example, suppose the randomly generated number is 2483, and the guess made by the user is 8253. In this case, there is only one digit that has two numbers in common and is correctly placed (3). The number of digits common to both numbers, but with the wrong place, is two (2 and 8). Accordingly, the system that generated the number 2483 should say "PLUS 1, MINUS 2" as a hint to the user who guessed 8253. If there is no common digit between the guess and the generated number, the clue is called ZERO.
Note: It should be assumed that the generated number is correctly generated by the system. The rand(number) expression should be used inside the INPUT block to show that the number is randomly generated in the flowchart.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images