11.2 Programming a little game.

HERE IS THE GAME WE WANT TO PROGRAM:



The program chooses an integer between 0 and 32 and memorizes it. Then, a dialog box opens and asks the user to enter an integer. If this integer is equal to the saved integer, it displays “WIN” in the text zone. Otherwise, the program indicates if the saved integer in greater or lesser than the user’s integer and reopens the dialog box. The program will end when the user has found the correct integer.



We need to use the primitive random:

For example, random 20 returns an integer randomly between 0 and 19.



HERE ARE THE RULES TO CREATE THIS GAME:

SOME POSSIBLE IMPROVEMENTS: