Today, simple games, where there are no graphic or sound effects, are experiencing a rebirth. Playing them, the user focuses on the plot, and not on artistic techniques. The Pascal language is well suited for creating such games.
Instructions
Step 1
Download the Pascal compiler from the following page - https://edn.embarcadero.com/article/20803. Please read the terms of use for this software package and then install it
Step 2
Try to create a game in which the player is required to guess a number in the range from 0 to 100. First, enter the name of the program: program ugadayka;
Step 3
Connect the CRT unit: uses crt;
Step 4
Designate your variables like this: var
zagadka, mnenie, popytki: integer;
knopochka: char
Step 5
Start the program by clearing the screen and variables, and assigning a pseudo-random value to the hidden number: begin
clrscr;
randomize;
popytki: = 0;
mnenie: = 0;
zagadka: = int (rnd * 100);
Step 6
Make the computer ask the user what he thinks the hidden number is until he guesses it: while not mnenie = zagadka do
begin
popytki: = popytki + 1;
writeln ('Attempt number', popytki, '.');
write ('What do you think, what number is conceived?');
readln (mnenie);
if zagadka> mnenie then writeln ('No, the hidden number is greater!')
else writeln ('No, the hidden number is less!')
end;
Step 7
After the number is guessed, the automatic repetition of the above events will stop. The next lines of the program will start executing. In them, make the machine display information that the user guessed the number: writeln ('Congratulations! You guessed the number by trying the number', popytki, '. It really equals', zagadka, '.');
knopochka: = readkey
Step 8
Enter a statement to end the program: end.
Step 9
Save the program under any desired name using the menu items file -> Save as. In the future, after each edit, save it by pressing the F2 key.
Step 10
To start the program for execution, press the Control and F9 keys at the same time.
Step 11
After the program exits, in order to see what it displayed on the screen just before, press the alt="Image" and F5 keys at the same time. Press the same key combination again to return to the editor.