
Can someone upload a picture of the code in matlab
clear all
fprintf('\n welcome to guess my number game')
disp(' ')
a = input('\nPlease tell me you nice Name : ','s');
fprintf('\n\t Welcome to the game %s',a)
disp(' ');
m1 = 1;
while m1 == 1
disp(' ');
disp('Choose the level of playing:')
disp('1) 1-10')
disp('2) 1-100')
disp(' ')
o = input('enter the level you want to play: ');
disp(' ')
switch o
case 1,
n = 10;
case 2,
n = 100;
end
b = randperm(n);
index = randperm(length(b));
r = b(index(1));
m2 = 1;
count = 0;
while m2 == 1
guess='r';
while guess == 'r'
guess = input('Input your guess: ','s');
end
guess = str2num(guess);
if (guess == r);
disp(' ')
fprintf('Correct! My secret number was: %i\n',r)
m2 = 2;
elseif (guess > n);
disp(' ')
fprintf('Too high, please less than %i\n',n)
disp(' ')
elseif (g < 1);
disp(' ')
disp('Too low, please more than %i\n',n)
disp(' ')
elseif (guess > r);
disp('Lower')
else (guess < r);
disp('Higher')
end
count = count+1;
end
disp(' ')
fprintf('Guesses needed to find my secret number: %i\n',c)
disp(' ')
if (count == 1);
disp('marvallous')
elseif (count >= 2 && count < 0.5*n);
disp('excellent')
elseif (count == 0.5*n);
disp('Avg')
elseif (count > 0.5*n && count <= 0.8*n);
disp('its very poor')
else (count > 0.8*n);
disp('better luck next time !')
end
disp(' ')
p = input('will u wish to play again? (yes/no): ','s');
if p == 'no'
m1 = 2;
end
disp(' ')
fprintf('Thank you very much %s\n',a)
end
Can someone upload a picture of the code in matlab Write a "Guess My Number Game"...
Guess My Number Create a mul5-func5on version of the Guess My Number game. Your game should generate a random number between 1 and 99, ask the user for a guess, and respond to each guess with correct, too high, or too low as needed. Once the user guesses the number correctly, report how many guesses it took and ask if they want to play again. You need to have at least the following three func5ons: displayInstruc5ons — no inputs, displays...
7.30 - Guess-the-Number Game (Project Name: GuessTheNumber) - Write an app that plays “Guess the Number” as follows: Your app chooses the number to be guessed by selecting a random integer in the range 1 to 1000. The app displays the prompt "Guess a number between 1 and 1000: ". The player inputs a first guess. If the player’s guess is incorrect, your app should display Too high. Try again. or Too low. Try again. to help the player “zero...
Number Guessing Game Games Write program in C++. For this game, the computer will select a random number between 1 and 100 (inclusive). The computer will then ask the (human) player to guess the number the computer has selected. After the player’s guess is input to the computer, the computer will output one of three responses, depending on the relationship of the number the player guessed to the number the computer selected: “Your guess was too low.” “Your guess was...
In Java You’re going to make a Guess the Number game. The computer will "think" of a secret number from 1 to 20 and ask the user to guess it. After each guess, the computer will tell the user whether the number is too high or too low. The user wins if they can guess the number within six tries. The program should look like this in the console, player input is in bold: Hello! What is your name? Abaddon...
Currently, the game allows players to play as many times as they wish. It does not provide any feedback on how the players are doing, however. Modify the game so that it keeps track of the number of games played as well as the average number of guesses made per game. To implement this change, add the following list of global variables to the beginning of the script’s Main Script Logic section. Assign each variable an initial value of zero....
Can you add code comments where required throughout this Python Program, Guess My Number Program, and describe this program as if you were presenting it to the class. What it does and everything step by step. import random def menu(): #function for getting the user input on what he wants to do print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the...
python
Exercise: ex9.py Write a program that plays a number and you guess the number. The program helps you with a response 1t the number you guessed is higher or lower than the mystery number. To generate a random number, we need to import some routines. guessing game. It generates a random mystery import random mysteryNumber random.randint (1, 100) The random.randint (1, 100) creates a random integer between 1 and 100. Here is a sample output: Let's play the guessing...
Write a game application that generates a random number between 1 and 1000 (inclusive) and prompts the user for a guess. Use the pseudorandom number generator, the Random class. When the user guesses the correct number, say so, and display how many guesses the user required to guess correctly. Allow the user to play multiple times by asking the user if the user wants to continue playing. Guess my number between 1 and 1000 => 500 Too high...
Write a program that prompts the user for an integer that the player (maybe the user, maybe someone else) will try to guess. If the player's guess is higher than the target number, the program should display "too high" If the user's guess is lower than the target number, the program should display "too low" The program should use a loop that repeats until the user correctly guesses the number. Then the program should print how many guesses it took....
In PYTHON 3- Implement a subclass (described below) of "Word Guess", a variant of the game Hangman. In this game, a word is first randomly chosen. Initially, the letters in the word are displayed represented by "_”. For example, if the random word is "yellow”, the game initially displays "_ _ _ _ _ _”. Then, each turn, the player guesses a single letter that has yet to be guessed. If the letter is in the secret word, then the...