ting your own programs "work through the gamesin , you will probably find 'making more and more esto them and eventually itowrite new games ofyour in these two pages you wil] ehints on how to setabout you start. itis a good idea to tink about what your and cannot do "It can select numbers at random by using RND. HE m a: k mal PA uz em di pad (ke decisions by comparing uOrmation in various ways. s, . k. m Č 4 as | lc. S KRA "Provided you use its language correctly, it can do only exactly what you tell it, even ifit is silly. Remember, when you are trying to work out a game, not to include anything which your computer won' beable to do. — pes Y | YOU the results ofits JNS and decisions andalso Slored in its memory. MAO z ' "A rr rta Planning a game Before you can tell the computer how to play your game, you must know exactly how to play it and what the rules are yourseli. The computer will needa series of simple logical instructions, so Work out your game ln your head or on paper first and then break it down into simple steps. Next write a plan (in English - don't try to use BASIC yet) ofall the stagesof the game in order. Here is a plan for a simple shooting game, suchas firing cannon balls ata pirate ship or shooting laser beamsat an alien invader, to give you an idea PLAN 1) PRINT TITLE AND INSTRUCTIONS 2) CHOOSE A TARGET FOR THIS GAME 3) BEGIN A LOOP To GIVE THE PLAYER N GOES 4) GET A SHOT FROM THE PLAYER 5) CHECK IF SHOT WAS ON TARGET 6) PRINT MESSAGE DEPENDING ON ACCURACYy OF SHOT 7) $0 BACK FOR ANOTHER GO IF SHOT WAS UNSUCCESSFUL a ai Nm IVRNUNONANOČU NU NNENUi UE NW RSKRNVATNEUN EERN RH NANA Writing the program The next stage is to convert your plan into BASIC. Each step in your plan may need several lines in BASIC. Don! forget to leave gaps when numbering your program lines so you can go back and add extra ones 1fyou needto Doa first draft of the program on paper first and then start testing onthe computer. Your computer will spot errors much more guickly than you will see them yourself and may give you a clue as to what is wrong Remember that debugging programs isalong, tedious process even for expert programmers, so don't expect to get yours ma Arst time. o JI lo! EH. Once you have got the core of the program working, you can add to it. Scoring, extra comments, more targets etc. can all be incorporated later. You could add sections from the programs in this book to your games. Don't expect to be able to write exciting and original games straight away. Keep your ideas very simple and be prepared to adapt them as you go along. You may find you have included something in your game which is easy for humans to do but very difficult for a computer. As you get more experienced you will begin to know instinctively what your computer can doand find it easlerto write programs for it.