Let the user guess several times (with responses each time) till he finds
the hidden number.
Allow the user to type
n - skip this game and start a new one
s - show the hidden value
x - exit
Now I can tell you that what you have is actually a 1 dimensional space fight
and you are trying to guess the distance of the enemy space ship.
As it is not a sitting duck, after every shot the spaceship can randomly move +2-2.
For trainng purposes you might want to limit the outer spaces to 0-100.
Make sure the enemy does not wander off the training field.
Give warning if the user shoots out of space.
Keep track of the minimum and maximum number of hits (in a file).
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Exercise: improve the color selector | Up | Solution: improved color selector |