home *** CD-ROM | disk | FTP | other *** search
/ Game Killer / Game_Killer.bin / 053.WARGAME.DAT < prev    next >
Text File  |  1990-06-20  |  19KB  |  1 lines

  1. ------------------------------------------------------------"A Military Strategy Game"                from January, 1990------------------------------------------------------------                                                            The general sighed as he handed the binoculars back  to  thelieutenant.   From  his  vantage  point high in the NorthernMountain range, he could see two enemy  divisions  advancingrapidly  toward  his own division stationed south of CentralLake.  That last remaining division had fought  bravely  andfiercely, but the men were on their last legs.  Heavy lossesin  earlier  battles had weakened their numbers to one-fifththeir original fighting strength.  Most of the armored trooptransport units were damaged  or  destroyed;  as  a  result,their own movement had slowed to a crawl.                                                                               As  tired  as the men were, they realized that they were thelast hope for defense of their capital city.  If  they  wereto fall, the enemy could advance and occupy the capital in amatter  of  hours.   Victory seemed so close only a few daysago, and now defeat was  staring  them  in  the  face.   Thegeneral  picked  up the walkie-talkie and relayed his ordersto the division commander.  "Proceed  due  east,"  he  said,"and  attack  the  advancing  enemy  divisions." Perhaps theelement of surprise would make the difference, he mused.  Ineither  event,  he  would know the answer before the day wasthrough.                                                                                                                Invitation to Play                                          ------------------                                                                                                      Does that scenario sound interesting to you?  Have you  everwanted  to  match  wits  with one of your friends to see whowould make the best military commander?  Have you ever  seenas many cliches used in just two paragraphs of purple prose?This month's program is a very simple military strategy gamefor  two  players.   It  allows  each  of you to command themovements of a ten-division army.  You decide when and  whomto   attack,   with  the  ultimate  goal  of  entering  youropponent's capital city and declaring victory.                                                                          Have you visited a toy store or an arts, crafts,  and  hobbystore  lately?   If  the ones in your town are anything likemine, you will find  one  or  more  aisles  devoted  to  warstrategy games.  This type of game is nothing new; "thinkingmen and women" have been enjoying this type of entertainmentfor  many  years.   Devoted fans have organized clubs, wheremembers meet to re-play key battles from the Roman  Empire'sconquests,  the American Civil War, World Wars I and II, andother famous battles from history.   Several  magazines  aredevoted to this field, too.                                                                                             Although  the  version  presented in the listing attached isquite simple,  it  does  introduce  and  illustrate  severalfundamentals  of  war  gaming.   First,  it  is  played on ahexagonal  grid;  most  if  not  all  war  games  use   thatarrangement.   As  you  will  see,  on its turn each playing"piece" on the game  board  can  move  in  any  one  of  sixdirections; hence, the usage of the term "hexagonal" or moresimply  "hex",  from the Latin term for "having six sides orangles".                                                                                                                Second, combat between opposing armies is  decided  using  aunique  blend  of  luck and skill.  As you will see when youplay this game, each army  division  is  assigned  a  numberindicating  its strength.  When you attack an opposing army,the ultimate outcome of that battle will be decided based onodds calculated from the relative  strengths  of  those  twodivisions.   Board games use dice to determine that outcome.Of course, the computer does not need dice; your Grandy willbe using using its random number generator for that purpose.                                                            Finally, this type of game encourages logical,  independent,unconventional,  and strategic thinking.  There are actuallyvery few rules in the game, and there are no  guaranteed  orobviously  successful  strategies.   Thus,  no two games areexactly  alike.   Each  of  your  friends  will  present  anentirely  different  challenge  -- possessing his or her ownstrengths and weaknesses.                                                                                               Rules of Play                                               -------------                                                                                                           Eventually you will have an error free copy of the  program.How  do you play?  First, locate a friend, your spouse, or asibling to  play  with;  this  game  requires  two  players.Second,  type  RUN  to  begin.   You  will  be  greeted withinstructions to enter the name of player number one.  Playernumber one will command the armies and defend  the  city  inthe  northwest  corner of the map (more on that later).  Youmust also enter the name of  player  number  two,  who  willcommand the army in the southeast corner of the map.                                                                    Following  the  entry  of  player's  names, the program willdisplay a chart demonstrating the hexagonal movement system.It might be wise to make a quick pencil sketch or  a  screenprint  of that chart.  According to that system, if you wantto move to the northeast, you must choose direction "1".   Amove  due  east  calls  for  direction  "2".   A move to thesoutheast is in direction "3", and so on.                                                                               Once you have studied the chart long enough, press any  key.A map showing the two capital cities, all of the armies, twomountain  ranges,  and  a lake will be shown.  Player numberone's  units  are  shown  as  red  characters  on  a   whitebackground  (or dark characters on a light background if youare using a monochrome monitor).  Player number two's  unitsare  shown as white characters on a red background (or lighton dark).                                                                                                               The capital  cities  are  shown  as  arrowheads.   The  armydivisions  are  shown  as numbers, initially all "3", "4" or"5"  characters.   The  mountain  ranges  are  shown   usingtriangular  characters;  you  will  have  to  use  a  littleimagination to see them as mountains.  The lake  is  a  blueblob.   Placement of the mountains and lake is random; thus,every  game  will  be  slightly  different.   The   "period"characters placed in the hexagonal arrangement represent theplaying field.                                                                                                          The  numbers  representing  each  army  division  serve  twopurposes.  First, they indicate how far  each  division  canmove  during your turn.  For example, on your turn, each oneof your "3" divisions can make three moves.  Moving from itscurrent  position  onto  any  one  of  the  six  surrounding(unoccupied)  field markers represents one move.  You cannotmove through mountains (they are assumed to be  impassable),into the lake, or off of the playing field.                                                                             The  numbers  also  indicate  the  fighting strength of thatdivision.  When one  of  your  divisions  attacks  an  enemydivision,  their  numbers  are  used  to determine the finaloutcome.  The probability of success in an attack is definedto be equal  to  the  attacking  unit's  strength  plus  onedivided  by  the  sum  of the attacking and defending unit'sstrengths.  For example, when a "5" attacks another "5", theprobability for victory is equal to (5+1) /  (5+5)  or  60%.Notice  that being on the offensive (which often carries theelement of surprise) is quite an advantage.                                                                             Command Decisions                                           -----------------                                                                                                       On your turn, each of  your  ten  divisions  will  begin  toblink.   If you wish to move that division, press one of thenumbers "1"  through  "6"  to  move  it  one  space  in  thedirection  indicated  by  the  hex  movement chart (that wasdisplayed on the opening screen).  If you  do  not  wish  tomove  that division at all or you do not wish to move it anyfurther, press "P" to pass.  Your next division  will  beginto blink, so that you may move it.                                                                                      Once  you  have moved all ten of your divisions, the programwill check to see if any of them  are  in  combat  position.Combat  occurs whenever one of your divisions is adjacent toan  opponent's  division.   If  any  of  your  divisions  isadjacent  to  two or more enemy divisions, you get to decidewhich one to attack.  Once again, you use the  hex  movementchart to tell the program which direction to attack.                                                                    During  combat,  you  will  hear the sound of gunfire as youwatch the battle progress.  The two armies will continue  tobattle  each  other,  reducing  each other's strength by oneunit at a time, until one is completely vanquished.  An armyreduced to a strength of zero will disappear.  You  can  winthe  game by entering your opponent's capital city.  It doesnot matter if you have completely eliminated your opponent'sarmies; you must still march into their capital city to makeit official.                                                                                                            Once  you  enter  the  opponent's  capital,  the  winner  isannounced  and you are offered the chance to play again.  Ifyou decide to play again, the game will  restart.   If  not,the  screen  will  clear and you will return to BASIC's "OK"prompt.  To return to DOS, type SYSTEM and press ENTER.  Thenext time you want to play this game, you  can  simply  typeBASIC WARGAME from the A> or C> prompt and press ENTER.                                                                 Programming Details                                         -------------------                                                                                                     Those of you who are interested in writing your own programsmight  be interested in learning more about how this programworks.  Several arrays are dimensioned in line 1060.   ArrayN$  contains  the  two  players  names.   Array P is used toremember the  game  board  position  of  both  player's  tendivisions.   Array M contains information pertaining to armymovements.  Array D is used during  the  search  for  combatsituations.                                                                                                             Each  "dot"  on the playing field is assigned a number.  Thenumbers are arranged so that a move  to  the  northeast  (ordirection  "1") decreases the position number by 19.  A movedue east increase the position number by 1.  These moves  aswell  as  all the others are stored in array M, whose valuesare defined in lines 1080 and 1090.                                                                                     The players' names are accepted and stored in lines 1110 and1120.  Lines 1130 through  1210  present  the  hex  movementchart and wait for any valid keystroke to begin the game.                                                               Lines  1250 through 1280 set up four user defined functions.Line 1250 defines function FNZ(X), which  returns  a  randomnumber  between  1 and X.  The next two functions FNR(X) andFNC(X) translate the playing field position number X into  ascreen  row and column number, respectively, like those usedin a LOCATE statement.  Finally, function FNL(X) returns theASCII  value  of  the  character  occupying  playing   fieldposition X.                                                                                                             The game board is presented in lines 1320 through 1390.  Thesolid  green  background  is  printed  in lines 1330 through1360.  The field position dots are  printed  in  lines  1370through  1390.   The  initial  playing  field  positions andstrengths of all army division are  read  and  displayed  inlines  1430 through 1450.  The DATA statements of lines 1460through 1490 contain that information.  The  capital  citiesare displayed in lines 1500 and 1510.                                                                                   Mountains and Lakes                                         -------------------                                                                                                     Lines  1550  through 1590 look for a clear spot to place thelake.  When a clear area large enough to hold the  lake  hasbeen  found  (picked  at  random),  the lake is displayed inlines 1600 through 1620.  Similarly, two mountain ranges aredisplayed in lines 1630 through 1700.  Each  range  containsseven little mountain peaks, using ASCII character 127.                                                                 One  player's  army  positions are represented with an arraypointer of zero; the other uses an array  pointer  equal  toone.   The  calculation  of T (answering the question "whoseTurn is it") in line 1700 selects one player to go first.                                                               Lines 1740 through 1760 announce the current player's  name.The  FOR-NEXT loop beginning in line 1770 blinks each of thecurrent player's remaining armies, and allows that player toeither move it or to pass.  If the player  decides  to  movethe  current army, line 1850 calculates a value for C -- theASCII value of  the  field  position  in  the  direction  ofmovement.   Line 1890 checks to see if that army is about toenter the capital city; if so, the  game  is  over  and  theprogram  jumps  to line 2460.  If C is not equal to 250 (the"dot" character used to represent an unoccupied space), thenthe move is invalid and is ignored.  If however the move  isvalid,  the screen is updated along with array P which keepstrack of each army's position.                                                                                          Line 2000 begins the check to see if any army is  in  combatposition.   If there is only one opposing army adjacent to agiven division, then the program jumps immediately  to  line2210  to  begin  combat.  If there is more than one possibledirection of attack,  lines  2110  through  2170  allow  thecommander to select that direction.                                                                                     Combat  is  handled  in  the section from line 2210 to 2360.Line 2250 is my feeble effort to make gunfire sounds. Noticethat it uses the NOISE statement.  Most other PC  compatiblecomputers  do  not  recognize the NOISE statement. To insurethat this program will also  work  on  those  other  pitifulbrands,  I have included an ON ERROR GOTO statement (back upin line 1070) which will jump around that troublesome  NOISEstatement.  Calculation of the probability of combat successis handled in line 2260.                                                                                                The subroutine in lines 2410 and 2420 clears the bottom halfof  the screen for messages.  Lines 2460 through 2500 handlethe end-game situation, allowing the user  to  start  a  newgame in line 2490 or to exit the program in line 2500. Lines2540  and  2550  are  special  ones which are called when anerror occurs.  Line 2540 checks to see if the error occurredin line 2250 (the one containing the  NOISE  statement);  ifso,  a  short click is issued and the program resumes on theline following the NOISE statement.                                                                                     Wrapping Up                                                 -----------                                                                                                             Here are a couple of ideas for program  improvements,  whichyou  can  use  as a challenge and a test of your programmingskills.  You might want to change the initial  positions  ofeach  division  on  the  playing  field,  or to change theirinitial strengths.   You  can  change  the  strengths  quiteeasily  up to "9" units by editing the second number in eachpair of numbers shown in lines 1460 through 1490.                                                                       One interesting and rather simple change would be  to  limitcombat  to  only  one exchange between opposing armies; thatis, instead of fighting until  one  division  is  completelydestroyed, limit the results of any single combat session toa one-unit reduction in one of the two opposing armies. Thatintroduces  the  strategy  of retreat, but it also lengthensthe game.                                                                                                               Once a division's strength is lowered as a result of battle,it can never recover those lost units.   Perhaps  you  wouldlike  to  modify  the  program so that on each turn, some ofeach unit's strength is  restored.   You  can  pretend  thatrepairs  have  been made to damaged transport equipment, andthat reinforcements have arrived to replace casualties.                                                                 This war game is not nearly as  ambitious  nor  as  rich  indetail as some of the boxed games available in toy and hobbystores.   However, it should serve as a good introduction tothe field, especially if you have never played a  game  likethis  before.   If you really like it, there are quite a fewcommercial software packages that you  might  enjoy.   Visityour local Radio Shack or some other software store, and askto  see  some  of  their  military strategy game titles.  Asalways, I encourage you to write with  questions,  comments,or  suggestions  for future columns.  If you write with somekind of programming question, be  sure  to  include  a  selfaddressed  stamped  envelope  with your letter; I will do mybest to answer all of your letters.  See you next month!