### Create an Account

Home / Questions / **PLEASE USE MATLAB AND DO NOT USE BREAK/CONTINUE COMMANDS** Video games are rather compli...

# **PLEASE USE MATLAB AND DO NOT USE BREAK/CONTINUE COMMANDS** Video games are rather complicated to p

**PLEASE USE MATLAB AND DO NOT USE BREAK/CONTINUE COMMANDS** Video games are rather complicated to program, not least ofwhich because of the graphics work that needs to be completed tofinish a video game. Still, even relatively simple games havehistorically had a chance of becoming popular(e.g. Tetris®). Since you are learning to programfor the first time, let’s look at a text-only game. Write a program that has the computer generate a pseudorandominteger between -100 and +100, and ask the user to guess what thenumber is. To generate the pseudorandom number, research and usethe randi command. If the user’s guess is higher than thecomputer-generated pseudorandom number, print a statement to thateffect. If the user’s guess is lower than the computer-generatedpseudorandom number, print a statement to that effect. Keep trackof how many guesses it takes for the user to guess the rightnumber, and print that information to the screen when the programterminates. Do not re-initialize the computer-generatedpseudorandom number between iterations, otherwise the user willhave a hard time trying to guess the computer-generatedpseudorandom number. Validate the user’s input; if the user enters a number greaterthan 100 or less than -100, prompt the user to enter a numberwithin the guess range. Do not count guesses out of range(i.e. greater than 100 or less than -100) as aniteration. Do not concern yourself with testing if the user enterednon-numeric input, and assume that the user will enter an integervalue. If the user enters the value inf, terminate the program(though count that iteration as a valid iteration for the purposesof seeing how many times the program iterated). Use no more than two while loops to solve this problem,and emulate the output format in these two sample runs: Sample Run #1 (with a computer-generated value of 9): Enter your guess: 8