Guessing Games with Random Numbers and Loops

The last step before we start with graphics is learning how to loop a section of code. Most games ``loop.'' They repeat the same code over and over. For example the number guessing game below loops for each guess that the user makes:

Video: The for loop
Hi! I'm thinking of a random number between 1 and 100.
--- Attempt 1
Guess what number I am thinking of: 50
Too high.
--- Attempt 2
Guess what number I am thinking of: 25
Too high.
--- Attempt 3
Guess what number I am thinking of: 17
Too high.
--- Attempt 4
Guess what number I am thinking of: 9
Too low.
--- Attempt 5
Guess what number I am thinking of: 14
Too high.
--- Attempt 6
Guess what number I am thinking of: 12
Too high.
--- Attempt 7
Guess what number I am thinking of: 10
Too low.
Aw, you ran out of tries. The number was 11.

Wait, what does this have to do with graphics and video games? A lot. Each frame the game displays is one time through a loop. You may be familiar with the frames-per-second (FPS) statistic that games show. The FPS represents the number of times the computer updates the screen each second. The higher the rate, the smoother the game. (Although an FPS rate past 60 is faster than most screens can update, so there isn't much point to push it past that.) Figure fig.fps shows the game Eve Online and a graph showing how many frames per second the computer is able to display.
Fatal error: Uncaught ArgumentCountError: Too few arguments to function figure(), 4 passed in /var/www/datas/dossiers_personnels/sebastien/Projets/Projets Python/programarcadegames.com/traduction/05_loops.php on line 52 and exactly 5 expected in /var/www/datas/dossiers_personnels/sebastien/Projets/Projets Python/programarcadegames.com/traduction/header_test.php:113 Stack trace: #0 /var/www/datas/dossiers_personnels/sebastien/Projets/Projets Python/programarcadegames.com/traduction/05_loops.php(52): figure('fig.fps', 'chapters/04_loo...', 'FPS in video ga...', 85) #1 {main} thrown in /var/www/datas/dossiers_personnels/sebastien/Projets/Projets Python/programarcadegames.com/traduction/header_test.php on line 113