Sinclair QL Beginner's Manual page 104

Hide thumbs Also See for QL:
Table of Contents

Advertisement

Simulate the auction using the equivalent of a six-sided die throw to start the bidding. A 'six' at
any of the starting prices will start it off.
When the bidding has started there should be a three out of four chance of a higher
bid at each invitation.
4. In a wild west shoot-out the Sheriff has no ammunition and wishes to arrest a gunman camped in
a forest. He rides amongst the trees tempting the gunman to fire. He hopes that when six shots
have been fired he can rush in and overpower the gunman as he tries to re-load. Simulate the
encounter giving the gunman a one-twentieth chance of hitting the Sheriff with each shot. If the
Sheriff has not been hit after six shots he will arrest the gunman.
5. The Sheriff's instructions to his Deputy are:
"If the gun is empty then re-load it and if it ain't then keep on firing until you hit the
bandit or he surrenders. If Mexico Pete turns up, get out fast."
Write a program which caters properly for all these situations:
Whatever happens, return to Dodge City
If Mexico Pete turns up, return immediately
If the gun is empty reload it
If the gun is not empty ask the bandit to surrender.
If the bandit surrenders, arrest him.
If he doesn't surrender fire a shot.
If the bandit is hit, arrest him and fix his wound.
Assume an unlimited supply of ammunition Use a simulated 'twenty-sided die' and let a seven
mean 'surrender' and a 'thirteen' mean the bandit is hit.

Advertisement

Table of Contents
loading

Table of Contents