home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 #9 / q09.d81 / t.cybertank < prev    next >
Encoding:
Text File  |  1989-01-01  |  16.3 KB  |  337 lines

  1.                                C Y B E R T A N K
  2.  
  3.                                 by Jon Mattson
  4.  
  5.       CYBERTANK is a simulation of future warfare, in a time when the
  6. soldiers are computer-controlled mechanical monster-tanks, and the generals
  7. are top military programmers.  That sounds simple enough at first, but
  8. trying to actually define what CYBERTANK IS can be much trickier: part game,
  9. part educational experience, part logic puzzle.  I prefer the last
  10. definition myself, since your ultimate goal is to piece together the
  11. "perfect" program - a puzzle of sorts.  But you may come up with other
  12. definitions while cursing the computer screen...
  13.  
  14.       Note that you need have no previous programming experience to have fun
  15. with CYBERTANK.  It is somewhat self-teaching, and, in any event, the
  16. language it uses is unique.  In fact, CYBERTANK is a very good way to teach
  17. yourself the rudiments of logical thinking in any programming language.
  18.  
  19.       When you first run the program, a title screen will appear and various
  20. routines and graphics will be loaded. You will quickly find yourself in the
  21. Command Processor, which is where you will do your coding.  It is split into
  22. three distinct windows:
  23.  
  24.       The large top List Window normally displays a partial (12 line)
  25. listing of your current program.  Of course, it will be empty at first,
  26. since no program is in memory.  When it does contain a program longer than
  27. 12 lines, you can scroll up and down through the list at almost any time
  28. with the CRSR UP/DOWN keys (either set).  Please remember this, as it is the
  29. only option which is not normally listed on the screen.
  30.  
  31.       The central one-line window is the Command Line.  This is where you
  32. will enter your commands; in fact, you'll notice a flashing cursor there
  33. waiting for you.
  34.  
  35.       The large bottom Help Window always shows the options currently
  36. available to you.  It is "case sensitive" and will change according to your
  37. needs at the time.  Virtually all commands are entered with 1 or 2 letter
  38. codes to make typing easier, although a few may also prompt you for numeric
  39. input.
  40.  
  41.       For the moment, press ! to END your current (empty) program.  You will
  42. now be at the Main Menu, and the Command Line will inform you that it is
  43. waiting for instructions. Examining the Help Window, you will see 7 options:
  44.  
  45.   COMMAND PROCESSOR: This simply takes you back into the section previously
  46. described, where you may add lines to the end of your current program.
  47.  
  48.   INSERT COMMAND: This option and its counterpart, below, allow you to edit
  49. a program in memory.  You will be prompted for a command number at which to
  50. make the Insertion - remember that you can scroll through the listing with
  51. the cursor keys to check anything you need to know.  The listing will then
  52. shift to display the target area - the lines just before and just after the
  53. insertion point.  You will briefly enter the CP section to type in the
  54. Inserted command.  Note that Insert automatically updates any JUMP commands
  55. and the like, so you need not worry that your change will wreak havoc with
  56. program logic.  For this reason, always remember to base any Inserted JUMPs
  57. on the listing you actually see at the moment - not on what it will end up
  58. being.  Just do things in the easiest way, and the CP will take care of the
  59. rest.
  60.  
  61.   DELETE COMMAND: You will be prompted for a command number - which will
  62. then vanish.  Again, any JUMPs and the like will automatically be updated.
  63. JUMPs to a Deleted line will be shifted to the line following it, so be
  64. careful that this still makes sense.
  65.  
  66.   SAVE PROGRAM: You will be prompted for a unique 3-digit "pass code", which
  67. will be used to Save the program in memory to disk.  Avoid using '999', as
  68. the included sample uses this code.  Remember that it's not a wise idea to
  69. save anything to your LOADSTAR disk: any other disk with at least 9 free
  70. blocks per program will do.
  71.  
  72.   NEW PROGRAM: This will give you two options: start a New program from
  73. scratch or Load one from disk.  In the latter case, you will have to enter
  74. the program's 3-digit "pass code". Once the program is Loaded into memory,
  75. you will automatically be moved to the CP mode to examine it. If you want to
  76. examine a sample program, pick this option and enter '999' for the "pass
  77. code".  That will Load the sample included with CYBERTANK, which we'll talk
  78. about in greater detail later.
  79.  
  80.   FIELD TEST: This allows you to enter the Combat Simulator and test out
  81. your masterpiece.  We'll talk more about this later, too.  QUIT: This will
  82. exit CYBERTANK and return you to LOADSTAR if the disk is in the drive.
  83.  
  84.       Now, let's go back into the CP and take a closer look at the many
  85. commands available to you.  You should get used to three conventions first:
  86.  
  87.   1. Directions are always given with a digit 'n' from 0 to 7, with 0 being
  88. north, 1 being northeast, and so on.
  89.  
  90.   2. A special 'box' has been set aside to hold any single number you want
  91. the tank to remember.  This 'box' is called the HOLDER and is represented by
  92. H.  If you are a programmer, think of H as a standard variable which can
  93. hold numbers from 0 to 255.  If you aren't, just think of it as a box which
  94. can hold one number at a time so that you can examine it later.
  95.  
  96.   3. There will be times when you will want to keep track of how many times
  97. something has been done.  Your tank has two COUNTERS - C1 and C2 - for this
  98. purpose.  Several commands allow you to manipulate these COUNTERS
  99. individually, as explained below.
  100.  
  101.       Now for the commands:
  102.  
  103.   END: This ENDs whatever mode you are currently in.  In the CP, it returns
  104. you to the Main Menu.  In a Field Test, it ENDs the current program and puts
  105. you into Direct Mode (see below).  In Direct Mode, it switches control back
  106. to the program, either where it left off from a QUERY or at the beginning
  107. from an END.  This sounds complicated but is really quite simple in
  108. practice, as you'll soon see.
  109.  
  110.   IF: This sets up a decision making sequence and must always be followed by
  111. a Condition (see below).  When your tank encounters this command, it will
  112. try to decide if the condition is true or not.  If so, it will perform
  113. whatever instructions follow in the IF... sequence, until it hits an END IF
  114. (see below).  If not, it will skip the whole sequence, jumping down in the
  115. program past the END IF.  To make these sequences easier to pick out in the
  116. program, the CP indents all commands following the IF and uses a different
  117. text color, until the sequence is finished.  An example will be given later,
  118. where it will make more sense, and should clarify the use of this important
  119. command.
  120.  
  121.   END IF: This command simply denotes the end of an IF... sequence for the
  122. computer.  Every IF should have a matching END IF (or END IF w/JUMP); in
  123. fact, the CP will not allow you to exit until this condition is met.  Of
  124. course, careless Insertions and Deletions can ruin this pattern and cause
  125. unpredictable results - so be careful.
  126.  
  127.   END IF w/JUMP: This command acts as an END IF, but also automatically
  128. jumps to a new command of your choice instead of the one following the IF
  129. sequence.  Think of it as an END IF and JUMP combined into one command, only
  130. performed when the IF sequence is active.
  131.  
  132.   JUMP: As above, this command causes control to move to a new command of
  133. your choice.  Think of it as a BASIC GOTO.  Of course, unlike the above,
  134. this command is non-conditional and cannot be performed from within an IF
  135. sequence.
  136.  
  137.   FORWARD: Moves the tank forward one "space".
  138.  
  139.   REVERSE: Moves theatank back one "space".
  140.  
  141.   TURN LEFT: Turns the tank left 90 degrees, based on its current facing.
  142. Since the resulting direction will be relative to the tank's original
  143. facing, it is important to keep track of these changes if the tank's course
  144. in important to your program's logic. The HOME command (below) is useful in
  145. this regard.
  146.  
  147.   TURN RIGHT: As above, but turns right 90 degrees.
  148.  
  149.   RANDOM: The tank will pick one of the four movement choices above
  150. randomly. Since this makes keeping track of the tank's current course
  151. difficult, this command should be used sparingly.  It is good for shaking up
  152. any pattern the tank seems to be falling into.
  153.  
  154.   FIRE n: This is actually a set of 8 commands: FIRE 0, FIRE 1, etc.  It
  155. tells the tank to fire its gun at direction n.
  156.  
  157.   FIRE H: Fire in direction indicated by H.
  158.  
  159.   EXPLODE: This will end your session quickly - but with a lower rating!  It
  160. can sometimes be used to wipe out one last enemy in an otherwise hopeless
  161. situation or, in Direct Mode, to end the test prematurely.
  162.  
  163.   HOME: Figures out in which direction your home base lies.  The information
  164. can then be used by a special set of Conditions (see below).  This command
  165. also puts the tank's current facing in H: 0 for North, 2 for East, 4 for
  166. South and 6 for East.  This can be useful at times but also wipes out
  167. whatever you had in H, so be careful. In Direct Mode, this command will also
  168. print the actual direction of your home base (N, NE, etc.) on the command
  169. line for a moment so that you can get your bearings.
  170.  
  171.   SCAN: The tank will determine the direction of any potential targets, to
  172. be used with the Conditions listed below.  Of course, not all 'targets' are
  173. hostile... More on this later. This command also puts the latest target's
  174. direction in H, which allows you a shortcut method of finding and shooting
  175. targets: SCAN, then FIRE H. Of course, this is not a particularly
  176. discriminating method.
  177.  
  178.   FIX DAMAGE: The tank will ATTEMPT to repair up to 10% of the damage it has
  179. taken.  The worse shape its in, the less likely it is that it will succeed.
  180.  
  181.   QUERY: The program will pause and put you in Direct Mode (see below). 
  182. This will continue until you END Direct Mode, at which time the program will
  183. pick up where it left off.
  184.  
  185.   COUNT1: This simply counts, adding 1 to C1. C2 has a like command.  Note
  186. that a COUNTER 'turns over' at 256, going back to 0.
  187.  
  188.   ZERO COUNTER1: This resets C1, back to 0.  C2 has a like command.
  189.  
  190.   PUT COUNTER 1 IN HOLDER: Does just what it says.  C2 has a like command.
  191. This is useful for making several similar actions; for example, to fire in
  192. all 8 directions: Put C1 in H, Fire H, Count1, then start again if C1 is
  193. less than 8.
  194.  
  195.       As previously noted, there are also a number of Conditions for use
  196. with an IF command.  These will only appear in the Help Window just after
  197. the input of an IF, and include:
  198.  
  199.   COUNTER1 =: Checks to see if C1 is equal to a number you specify.  If so,
  200. the IF sequence is performed.  C2 has a like command.
  201.  
  202.   HOLDER =: As above, but applies to H.
  203.  
  204.   DAMAGE >=: As above, but applies to the damage the tank has taken in 10%
  205. increments from 0 to 9.  Since you are generally concerned with high damage
  206. scores, the comparison is a "greater than or equal to" one instead of just
  207. "equal to".  For example, a damage of 5 would trigger a DAMAGE >=3
  208. Condition.
  209.  
  210.   HOME DIRECTION =: As above, but applies to the current direction of your
  211. home base.  Of course, this decision can only be made properly after a HOME
  212. command.
  213.  
  214.   OBSTACLE: This Condition will be true when the last move the tank tried to
  215. perform was unsuccessful.  This is a common check and will be used in an
  216. example later.
  217.  
  218.   TARGET AT n: This is actually a set of 8 Conditions: TARGET AT 0 and so
  219. on.  The Condition will be true when a target lies in direction n.  This is
  220. naturally only useful after a SCAN.
  221.  
  222.   TARGET AT H: As above, but applies to the direction indicated by H.
  223.  
  224.   HIT FROM n: This is actually a set of 8 Conditions: HIT FROM 0, HIT FROM 1
  225. and so on.  This Condition will be true when the tank is struck by an enemy
  226. in direction n.  By combining this check with FIRE n, you can create a tank
  227. with 'fire only if fired on' orders.
  228.  
  229.   HIT FROM H: As above, but applies to the direction indicated by H.
  230.  
  231.       Phew!  Well, you probably won't be able to take this in all at once,
  232. but you will get used to it in time - and, once you do, you will appreciate
  233. the versatility the many commands offer.  The Help Windows also prevent the
  234. need for much memorization.
  235.  
  236.       A couple of simple examples are probably in order:
  237.  
  238.     000 SCAN
  239.     001 IF TARGET AT H
  240.     002  FIRE H
  241.     003  END IF w/JUMP TO 000
  242.     004 FORWARD
  243.  
  244. To paraphrase this in plain English:   1. Look around  2. If you notice any
  245. target, fire at it then go back to step 1...  3. ...otherwise move forward. 
  246. Simple, right?  Here's another common programming example:
  247.  
  248.  
  249.     000 FORWARD
  250.     001 IF OBSTACLE
  251.     002  TURN LEFT
  252.     003  END IF
  253.     004 JUMP 000
  254.  
  255. Or, in plain English:
  256.  
  257.  1. Move forward
  258.  2. If that didn't work, turn left
  259.  3. Go back to step 1 and do it again
  260.  
  261.       At this point, you should probably use the New Program command from
  262. the Main Menu to Load file '999'.  Study it carefully and try to see what's
  263. going on.  Then, go back to the Main Menu and try a Field Test to see if
  264. you're right.
  265.  
  266.       When you enter the Combat Simulator, the List Window will be replaced
  267. by a view of your tank's surroundings, a computer generated battlefield
  268. which changes with each test.  Your tank sits in the center of the screen,
  269. just south of 'home base'.  There are several types of terrain, and many of
  270. these are impassable to a computer-controlled CYBERTANK, as you will soon
  271. discover.
  272.  
  273.       The Command Line will be inactive, except for a notation that your
  274. program is running.  Likewise, the Help Window will be empty except for a
  275. counter which keeps track of your tank's damage in 10% increments.  Keep an
  276. eye on this: you'll notice that your tank performs less reliably when badly
  277. damaged, sometimes skipping commands altogether.
  278.  
  279.       As you watch, the tank should kick into action, following its
  280. programmed instructions.  Targets of various types will appear, mostly
  281. attempting to eliminate your cybernetic marvel, and the battle will begin. 
  282. This will continue until the tank either gets back to home base or is
  283. destroyed.
  284.  
  285.       As the Command Line indicates, you can 'break into the program' at any
  286. time by pressing the back arrow.  In fact, this will automatically occur
  287. whenever a QUERY instruction comes up.  This puts the tank into Direct Mode,
  288. and allows you to issue a sub-set of individual commands directly to it, as
  289. indicated by the Help Window.  This is handy for getting it out of a
  290. situation you hadn't predicted or sending it home. Press ! (END) at any time
  291. to exit Direct Mode.
  292.  
  293.       On the negative side, the enemy will not sit and wait for you to type
  294. in instructions.  Keep in mind, too, that every Direct command you enter
  295. will reduce your program's final combat rating.  After all, your real goal
  296. is to create a program which can handle anything thrown at it WITHOUT human
  297. intervention.
  298.  
  299.       When your tank exits the field, in glory or in pieces, you will be
  300. given a rating of its performance.  This takes into account many factors:
  301. the number of enemies destroyed and non-Direct commands processed, the
  302. tank's ultimate fate and so on.  It is reduced by over-use of Direct Mode
  303. and by the destruction of non-hostile targets.
  304.  
  305.       Don't be discouraged by a low rating at first: it takes time to master
  306. CYBERTANK programming.  You may wish to run the same program through more
  307. than once before altering it, to cancel out the 'luck factor' somewhat -
  308. especially if you are challenging a friend to a 'duel of cybernauts'.
  309. Remember, though, that one of your main goals should be to design a program
  310. which can work around this luck factor.  There are no second chances on a
  311. real battlefield!
  312.  
  313.       A few last hints, tips and things to think about:
  314.  
  315.   1. You'll quickly discover that not all targets are hostile.  In fact, you
  316. will LOSE points for every android destroyed, since it represents one of
  317. your own troops!  This problem CAN be avoided - but you'll have to figure
  318. out how yourself.
  319.  
  320.   2. Getting home after a successful battle can be tricky, but, again, it
  321. CAN be done without resorting to Direct Mode.  You'll also have to decide
  322. your criteria for making the return trip.  After a certain length of time? 
  323. After shooting x enemies? The counters are useful here, but the rest is up
  324. to you.
  325.  
  326.   3. Don't look to the sample program to solve these and other puzzles for
  327. you.  It is fairly basic - adequate, but not especially intelligent - and
  328. designed mainly to give you a jumping off point.  As I said before, this is
  329. a puzzle of sorts, and there's not much point in giving away all the answers
  330. right away.  Besides, this is a puzzle with more than one 'correct
  331. solution', and its up to you to find the one you like best.  When you think
  332. you have it licked, try challenging an interested friend and see who really
  333. is the Patton of the CYBERTANK arena!
  334.  
  335. JM
  336.                              **** End of Text ****
  337.