Zmiany

Module 6 - The “Guess the NumberLogic Game” Project

Dodane 961 bajtów, 09:55, 6 lip 2015
''In this case, we help students find the loop repeat until.''
 
 
[[Plik:Tip2.png|center]]
 
We modify the algorithm written down on the boardaccordingly and include the loop repeat untilin it. The modified algorithm may look like this:
 
After the programme is started:
* it displays a message telling you how to play, e.g. “I thought of a number between 1 and 100. Guess what number it is!”
* it draws a number (in the range from 1 to 100) and stores it in a variable
* it displays the words “Give a number” and waits for the player’s answer
* it repeats the following instructions until the player’s answer matches the randomly selected number stored in the variable:
* it checks if the number given by the player is greater than the randomly selected one
if it is
it displays the message: “Too high!”
otherwise
it displays the message “Too low!”
it displays the words “Give a number” and waits for the player’s answer
it displays “Well done!”
it ends the script execution
181
edycji