home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0950.lha / BBDoors / BBDoors65.lha / rexxDoors / Ship_Hunt.rexx < prev    next >
OS/2 REXX Batch file  |  1993-08-07  |  19KB  |  692 lines

  1. /* Ship_Hunt.rexx version 2.3 by Matt English 1-10-93
  2.    This is an ONLINE game designed for the BBBBS system.
  3.    This game is freely distributable as long as no one makes
  4.    any money from it and the credits remain on the title screen.
  5.    To run on BBBBS, just copy the program "Ship_Hunt.rexx"
  6.    to your RexxDoors directory.
  7.     For bug reports or comments call Matt English (sysop)
  8.                                      Alternative BBS
  9.                                      503-761-3043
  10. */
  11.  
  12. options results
  13. FF='0C'x  /* FormFeed */
  14. CR='0D'x  /* Carraige Return */
  15. CALL TIME('R')
  16. SIGNAL ON BREAK_C
  17. SIGNAL ON BREAK_E
  18.  
  19. bbspath=GETCLIP('BBS_path')
  20. bbspath=bbspath'rexxDoors/Data/'
  21. datapath = bbspath'Ship'
  22.  
  23. PARSE arg Username winnings . colorflag secs .
  24. IF secs='' THEN secs=3600
  25. signal on syntax
  26.  
  27. name = Username
  28. letters = 'abcdefghijq'
  29.  
  30. def=''
  31. pen0=''
  32. pen2=''
  33. pen3=''
  34. pen4=''
  35. pen5=''
  36. pen6=''
  37. pen7=''
  38. bak2=''
  39. bak3=''
  40. bak4=''
  41. bak5=''
  42. bak6=''
  43. bak7=''
  44. CLS = 'H'
  45. UNL = ''
  46.  
  47. IF colorflag=1 THEN
  48.   DO
  49.     def=''
  50.     pen0=''
  51.     pen2=''
  52.     pen3=''
  53.     pen4=''
  54.     pen5=''
  55.     pen6=''
  56.     pen7=''
  57.     bak2=''
  58.     bak3=''
  59.     bak4=''
  60.     bak5=''
  61.     bak6=''
  62.     bak7=''
  63.     CLS = 'H'
  64.     UNL = ''
  65.   END
  66.  
  67. PPrompt = '2H'
  68. pmess = '12H'
  69. pmess2 = '12H'
  70. pturn = '64H'
  71. down.1 = '7H'
  72. down.2 = '7H'
  73. down.3 = '57H'
  74. down.4 = '57H'
  75.  
  76. stline = 5
  77. do aa = c2d('A') to c2d('J')
  78.  al = d2c(aa)
  79.  stpos = 28
  80.  stline = stline + 1
  81.  do bb = 1 to 10
  82.   stpos = stpos + 2
  83.   p.al.bb = ''stline';'stpos'H'
  84.   end
  85.  end
  86.  
  87. /* Open the support library if it is not already open. */
  88. if ~show('L',"rexxsupport.library") then do
  89.     addlib('rexxsupport.library',0,-30,0)
  90.      end
  91.  
  92. wz = random(1,999,time('S')) /* initalize random number generator */
  93.  
  94. if ~exists(datapath) then makedir(datapath)
  95. if ~exists(datapath'/winners') then do
  96.  call open(win,datapath'/winners','w')
  97.  top = 90
  98.  do 10
  99.   call writeln(win,''date()'... MATT_ENGLISH..... sank all the ships in 'top' shots!')
  100.   top = top + 1
  101.   end
  102.  call close(win)
  103.  end
  104.  
  105. say cr
  106. say cr
  107. say cr
  108. say'                          'bak7''pen0' Welcome to Ship Hunt ! 'def''cr
  109. say'                          'bak7''pen0'  version 2.3 1-10-93   'def''cr
  110. say'                          'bak7''pen0'    by Matt English     'def''cr
  111. say cr
  112. say cr
  113. call delay(100)
  114. call showwin
  115. say cr
  116. options prompt' Type "I" for instructions or hit return to play > '
  117. pull input
  118. if input ~= 'I' then call start
  119. else call instructions
  120. call start
  121.  
  122. showwin:
  123.  call open(win,datapath'/winners','r')
  124.  say'                   'bak5''pen0'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'def''cr
  125.  say'                   'bak5''pen0'%       Top Ship Hunt Winners!       %'def''cr
  126.  say'                   'bak5''pen0'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'def''cr
  127.  say cr
  128.  say cr
  129.  do 10
  130.   line = readln(win)
  131.   call sac70''line''
  132.   end
  133.  call close(win)
  134.  say cr
  135.  call delay(200)
  136. return
  137.  
  138. instructions:
  139.  say cr
  140.  say' This is a very simple game. The object is to sink the 5 ships'cr
  141.  say' that the computer has hidden on a 10 x 10 grid. If you can sink'cr
  142.  say' all the ships using less shots than a player on the WINNERS list,'cr
  143.  say' your name will be added to the winners list and you''ll be famous!'cr
  144.  say cr
  145.  say' The computer will generate a new grid for each game played, so you''ll'cr
  146.  say' never play the same game twice and no other player plays the same grid'cr
  147.  say' that you''re playing. The ships are:'cr
  148.  say'                                      Carrier...... 5 spots'cr
  149.  say'                                      Battleship... 4 spots'cr
  150.  say'                                      Destroyer.... 3 spots'cr
  151.  say'                                      Submarine.... 3 spots'cr
  152.  say'                                      PT Boat...... 2 spots'cr
  153.  say cr
  154.  say' If you decide to quit in the middle of a game, your stats will be'cr
  155.  say' saved and you can pick up where you left off next time.'cr
  156.  say cr
  157.  call sac70'HAVE FUN!'
  158.  say cr
  159.  call pressreturn
  160.  return
  161.  
  162. START:
  163. shipsdown = ''
  164. if ~exists(datapath'/'name) then do
  165.  say'Stand by, setting up the game..'
  166.  call setupdata
  167.  end
  168. if justsetup ~= 1 then do
  169.  say cr
  170.  options prompt' Would you like to continue your previous game? (Y,n) > '
  171.  pull answer
  172.  if answer = 'N' then do
  173.   say' OK,Setting up a new game..'cr
  174.   call setupdata
  175.   end
  176.  else do
  177.   say cr
  178.   say' OK, Loading your previous game...'cr
  179.   say cr
  180.   end
  181.  end
  182. call loaddata
  183. say cr
  184. if justsetup ~= 1 then say' You last played this game on 'pen7''lastplay''def''cr
  185. call delay(100)
  186. say cr
  187. say cr
  188. say cr
  189. call play
  190.  
  191. Play:
  192.  say cls
  193.  say'               'pen5'                   'bak2'Ship Hunt'def''cr
  194.  say cr
  195.  say'                             1 2 3 4 5 6 7 8 9 10'cr
  196.  say'  ' cr
  197.  say'  'bak6''UNL'Ship       Size'def'        A   's.a.1' 's.a.2' 's.a.3' 's.a.4' 's.a.5' 's.a.6' 's.a.7' 's.a.8' 's.a.9' 's.a.10'        'bak4''UNL'Ships Sunk'def''cr
  198.  say'  'bak6'               'def'        B   's.B.1' 's.B.2' 's.B.3' 's.B.4' 's.b.5' 's.b.6' 's.b.7' 's.b.8' 's.b.9' 's.b.10''cr
  199.  say'  'bak6'Carrier      5 'def'        C   's.c.1' 's.c.2' 's.c.3' 's.c.4' 's.c.5' 's.c.6' 's.c.7' 's.c.8' 's.c.9' 's.c.10''cr
  200.  say'  'bak6'Battleship   4 'def'        D   's.d.1' 's.d.2' 's.d.3' 's.d.4' 's.d.5' 's.d.6' 's.d.7' 's.d.8' 's.d.9' 's.d.10''cr
  201.  say'  'bak6'Destroyer    3 'def'        E   's.e.1' 's.e.2' 's.e.3' 's.e.4' 's.e.5' 's.e.6' 's.e.7' 's.e.8' 's.e.9' 's.e.10''cr
  202.  say'  'bak6'Submarine    3 'def'        F   's.f.1' 's.f.2' 's.f.3' 's.f.4' 's.f.5' 's.f.6' 's.f.7' 's.f.8' 's.f.9' 's.f.10''cr
  203.  say'  'bak6'PT Boat      2 'def'        G   's.g.1' 's.g.2' 's.g.3' 's.g.4' 's.g.5' 's.g.6' 's.g.7' 's.g.8' 's.g.9' 's.g.10''cr
  204.  say'                         H   's.h.1' 's.h.2' 's.h.3' 's.h.4' 's.h.5' 's.h.6' 's.h.7' 's.h.8' 's.h.9' 's.h.10''cr
  205.  say'                         I   's.i.1' 's.i.2' 's.i.3' 's.i.4' 's.i.5' 's.i.6' 's.i.7' 's.i.8' 's.i.9' 's.i.10'        'pen3'"Q" = Quit'def''cr
  206.  say'                         J   's.j.1' 's.j.2' 's.j.3' 's.j.4' 's.j.5' 's.j.6' 's.j.7' 's.j.8' 's.j.9' 's.j.10'        Turn #  'cr
  207.  say cr
  208.  say cr
  209.  call clrl2
  210.  call pullshotl
  211.  
  212. clrl:
  213.  arg where
  214.  call writech('STDOUT',''where'                                                              ')
  215.  return
  216.  
  217. clrl2:
  218.  call writech('STDOUT',''pmess''bak3'                                                  'def'')
  219.  call writech('STDOUT',''pmess2''bak3'                                                  'def'')
  220.  return
  221.  
  222. pullshotl:
  223.  if shipsdown ~= '' then do sd = 1 to words(shipsdown)
  224.   say''down.sd''word(shipsdown,sd)''
  225.   end
  226.  turns = turns + 1
  227.  say''pturn''turns''
  228.  options prompt''PPrompt'Enter your shot, Captain 'name' > '
  229.  pull theshot
  230.  CALL checkBBS()
  231.  call clrl pprompt
  232.  call clrl2
  233.  theshot = strip(theshot)
  234.  if theshot = 'Q' then call quit
  235.  shotl = substr(theshot,1,1)
  236.  shotn = strip(substr(theshot,2,2))
  237.  if length(theshot) > 3 | if theshot = '' |  ~(instring(shotl,letters)) | ~datatype(shotn,'W') | shotn > 10 | shotn < 1 then do
  238.   say''pmess'  'bak3' Please enter your shot in letter/number format'def''cr
  239.   say''pmess2'  'bak3'              Examples: A3 B10 C4              'def''cr
  240.   turns = turns - 1
  241.   call pullshotl
  242.   end
  243.  call checkshot
  244.  
  245. Quit:
  246.  turns = turns - 1
  247.  say cr
  248.  say''pmess''bak3'     OK, Saving your stats for next time....'def''cr
  249.  call delay(50)
  250.  if exists(datapath'/'name) then call delete(datapath'/'name)
  251.  call open(stat,datapath'/'name,'w')
  252.  call writeln(stat,pos.c)
  253.  call writeln(stat,pos.b)
  254.  call writeln(stat,pos.d)
  255.  call writeln(stat,pos.s)
  256.  call writeln(stat,pos.p)
  257.  call writeln(stat,damage.c)
  258.  call writeln(stat,damage.b)
  259.  call writeln(stat,damage.d)
  260.  call writeln(stat,damage.s)
  261.  call writeln(stat,damage.p)
  262.  call writeln(stat,shipssunk)
  263.  call writeln(stat,hits)
  264.  call writeln(stat,misses)
  265.  call writeln(stat,lastplay)
  266.  call writeln(stat,turns)
  267.  call close(stat)
  268.  say cr
  269.  call showwin
  270.  say cr
  271.  say' 'pen2'Returning to the BBS...'def''
  272.  say cr
  273.  call delay(25)
  274.  exit
  275.  
  276.  
  277. checkBBS:
  278. IF ADDRESS()~='BAUD' THEN RETURN 0
  279. IF TIME('E')>secs THEN SIGNAL Quit
  280. dcd
  281. IF RC=0 THEN SIGNAL Quit
  282. temp=secs-TIME('E')
  283. IF temp<120 THEN SAY '*** Only' temp 'seconds left! ***'CR 
  284. RETURN 0
  285.  
  286.  
  287. showshot:
  288.    gg = 0
  289.    do 10
  290.     gg = gg + 1
  291.     if gg = 10 then gg = 0
  292.     say''p.shotl.shotn''pen4''gg''def''cr
  293.     say''p.shotl.shotn''pen5'&'def''cr
  294.     say''p.shotl.shotn''pen6'#'def''cr
  295.     end
  296.     say''p.shotl.shotn'-'cr
  297. return
  298.  
  299. checkshot:
  300.  shot = shotl||shotn
  301.  /* Check to see if this is a repeat shot */
  302.  do w = 1 to words(hits)
  303.   if word(hits,w) = shot then do
  304.    say''pmess''bak3'           That spot has already been shot!'def''
  305.    call delay(50)
  306.    turns = turns - 1
  307.    call pullshotl
  308.    end
  309.   end
  310.  do y = 1 to words(misses)
  311.   if word(misses,y) = shot then do
  312.    say''pmess''bak3'           That spot has already been shot!'def''
  313.    call delay(50)
  314.    turns = turns - 1
  315.    call pullshotl
  316.    end
  317.   end
  318. /* Check to see if it's a hit */
  319.  do w = 1 to words(pos.c)
  320.   if word(pos.c,w) = shot then do
  321.    s.shotl.shotn = ''pen3'X'def''
  322.    hits = ''hits'' ''shot''
  323.    damage.c = damage.c + 1
  324.    call showshot
  325.    call delay(25)
  326.    say''p.shotl.shotn''s.shotl.shotn''cr
  327.    say''pmess''bak3'       It''s a HIT!      Good shot captain!'def''
  328.    if damage.c = 5 then do
  329.     call delay(100)
  330.     say''pmess2''bak3'           You just sank the Carrier!!!'def''
  331.     call delay(100)
  332.     shipsdown = shipsdown' Carrier'
  333.     shipssunk = shipssunk + 1
  334.     say cr
  335.     if shipssunk = 5 then call GameOver
  336.     end
  337.    call pullshotl
  338.    end
  339.   end
  340.  do w = 1 to words(pos.b)
  341.   if word(pos.b,w) = shot then do
  342.    s.shotl.shotn = ''pen3'X'def''
  343.    hits = ''hits'' ''shot''
  344.    damage.b = damage.b + 1
  345.    call showshot
  346.    call delay(25)
  347.    say''p.shotl.shotn''s.shotl.shotn''cr
  348.    say''pmess''bak3'        It''s a HIT!      Good shot captain!'def''
  349.    if damage.b = 4 then do
  350.     call delay(100)
  351.     say''pmess2''bak3'         You just sank the Battleship!!!'def''
  352.     call delay(100)
  353.     shipsdown =shipsdown' Battleship'
  354.     shipssunk = shipssunk + 1
  355.     say cr
  356.     if shipssunk = 5 then call GameOver
  357.     end
  358.    call pullshotl
  359.    end
  360.   end
  361.  do w = 1 to words(pos.d)
  362.   if word(pos.d,w) = shot then do
  363.    s.shotl.shotn = ''pen3'X'def''
  364.    hits = ''hits'' ''shot''
  365.    damage.d = damage.d + 1
  366.    call showshot
  367.    call delay(25)
  368.    say''p.shotl.shotn''s.shotl.shotn''cr
  369.    say''pmess''bak3'        It''s a HIT!      Good shot captain!'def''
  370.    if damage.d = 3 then do
  371.     call delay(100)
  372.     say''pmess2''bak3'          You just sank the Destroyer!!!'def''
  373.     call delay(100)
  374.     shipsdown = shipsdown' Destroyer'
  375.     shipssunk = shipssunk + 1
  376.     say cr
  377.     if shipssunk = 5 then call GameOver
  378.     end
  379.    call pullshotl
  380.    end
  381.   end
  382.  do w = 1 to words(pos.s)
  383.   if word(pos.s,w) = shot then do
  384.    s.shotl.shotn = ''pen3'X'def''
  385.    hits = ''hits'' ''shot''
  386.    damage.s = damage.s + 1
  387.    call showshot
  388.    call delay(25)
  389.    say''p.shotl.shotn''s.shotl.shotn''cr
  390.    say''pmess''bak3'        It''s a HIT!      Good shot captain!'def''
  391.    if damage.s = 3 then do
  392.     call delay(100)
  393.     say''pmess2''bak3'           You just sank the Submarine!!!'def''
  394.     call delay(100)
  395.     shipsdown = shipsdown' Submarine'
  396.     shipssunk = shipssunk + 1
  397.     say cr
  398.     if shipssunk = 5 then call GameOver
  399.     end
  400.    call pullshotl
  401.    end
  402.   end
  403.  do w = 1 to words(pos.p)
  404.   if word(pos.p,w) = shot then do
  405.    s.shotl.shotn = ''pen3'X'def''
  406.    hits = ''hits'' ''shot''
  407.    damage.p = damage.p + 1
  408.    call showshot
  409.    call delay(25)
  410.    say''p.shotl.shotn''s.shotl.shotn''cr
  411.    say''pmess''bak3'        It''s a HIT!      Good shot captain!'def''
  412.    if damage.p = 2 then do
  413.     call delay(100)
  414.     say''pmess2''bak3'            You just sank the PT Boat!!!'def''
  415.     call delay(100)
  416.     shipsdown = shipsdown' PT_Boat'
  417.     shipssunk = shipssunk + 1
  418.     say cr
  419.     if shipssunk = 5 then call GameOver
  420.     end
  421.    call pullshotl
  422.    end
  423.   end
  424.  s.shotl.shotn = ''pen2'*'def''
  425.  misses = ''misses'' ''shot''
  426.  call showshot
  427.  call delay(25)
  428.  say''p.shotl.shotn''s.shotl.shotn''cr
  429.  say''pmess''bak3'               That shot was a MISS!!'def''
  430.  say cr
  431.  call delay(30)
  432.  call pullshotl
  433.  
  434. Gameover:
  435.  call sac70'You sank all the ships in 'turns' shots!'
  436.  call delay(50)
  437.  call sac70'Checking your score against the winners list, hold on...'
  438.  say cr
  439.  call checklist
  440.  if madelist = 1 then call sac70'Congratulations, you made the winners list!'
  441.  else call sac70'You didn''t quite make the winners list that time...'
  442.  say cr
  443.  call delete(datapath'/'name)
  444.  options prompt'  Would you like to play again? (Y,n) > '
  445.  pull again
  446.  if again ~= "N" then call start
  447.  else do
  448.   say cr
  449.   call sac70'OK, thanks for playing.... Try again next time..'
  450.   say cr
  451.   call delay(25)
  452.   call showwin
  453.   say cr
  454.   say' 'pen2'Returning to the BBS...'def''cr
  455.   call delay(25)
  456.   exit
  457.  
  458. checklist:
  459.  madelist = 0
  460.  call open(win,datapath'/winners','r')
  461.  winline = ''date()'... 'left(name,17,".")' sank all the ships in 'left(turns,2)' shots!'
  462.  do wl = 1 to 10
  463.   line.wl = readln(win)
  464.   end
  465.  call close(win)
  466.  if turns <= word(line.10,10) then do
  467.   templine.10 = winline
  468.   madelist = 1
  469.   if turns <= word(line.9,10) then do
  470.    templine.9 = winline
  471.    templine.10 = line.9
  472.    end
  473.   else templine.9 = line.9
  474.   if turns <= word(line.8,10) then do
  475.    templine.8 = winline
  476.    templine.9 = line.8
  477.    end
  478.   else templine.8 = line.8
  479.   if turns <= word(line.7,10) then do
  480.    templine.7 = winline
  481.    templine.8 = line.7
  482.    end
  483.   else templine.7 = line.7
  484.   if turns <= word(line.6,10) then do
  485.    templine.6 = winline
  486.    templine.7 = line.6
  487.    end
  488.   else templine.6 = line.6
  489.   if turns <= word(line.5,10) then do
  490.    templine.5 = winline
  491.    templine.6 = line.5
  492.    end
  493.   else templine.5 = line.5
  494.   if turns <= word(line.4,10) then do
  495.    templine.4 = winline
  496.    templine.5 = line.4
  497.    end
  498.   else templine.4 = line.4
  499.   if turns <= word(line.3,10) then do
  500.    templine.3 = winline
  501.    templine.4 = line.3
  502.    end
  503.   else templine.3 = line.3
  504.   if turns <= word(line.2,10) then do
  505.    templine.2 = winline
  506.    templine.3 = line.2
  507.    end
  508.   else templine.2 = line.2
  509.   if turns <= word(line.1,10) then do
  510.    templine.1 = winline
  511.    templine.2 = line.1
  512.    end
  513.   else templine.1 = line.1
  514.   call delete(datapath'/winners')
  515.   call open(win,datapath'/winners','w')
  516.   call writeln(win,templine.1)
  517.   call writeln(win,templine.2)
  518.   call writeln(win,templine.3)
  519.   call writeln(win,templine.4)
  520.   call writeln(win,templine.5)
  521.   call writeln(win,templine.6)
  522.   call writeln(win,templine.7)
  523.   call writeln(win,templine.8)
  524.   call writeln(win,templine.9)
  525.   call writeln(win,templine.10)
  526.   call close(win)
  527.   end
  528. return
  529.  
  530.  
  531. loaddata:
  532.  call open(data,datapath'/'name,'r')
  533.  pos.c = readln(data)
  534.  pos.b = readln(data)
  535.  pos.d = readln(data)
  536.  pos.s = readln(data)
  537.  pos.p = readln(data)
  538.  damage.c = readln(data)
  539.  if damage.c = 5 then shipsdown = shipsdown' Carrier'
  540.  damage.b = readln(data)
  541.  if damage.b = 4 then shipsdown = shipsdown' Battleship'
  542.  damage.d = readln(data)
  543.  if damage.d = 3 then shipsdown = shipsdown' Destroyer'
  544.  damage.s = readln(data)
  545.  if damage.s = 3 then shipsdown = shipsdown' Submarine'
  546.  damage.p = readln(data)
  547.  if damage.p = 2 then shipsdown = shipsdown' PT_Boat'
  548.  shipssunk = readln(data)
  549.  hits = readln(data)
  550.  misses = readln(data)
  551.  lastplay = readln(data)
  552.  turns = readln(data)
  553.  call close(data)
  554.  do z = c2d('A') to c2d('J')
  555.   let = d2c(z)
  556.   call writech(stdout,'.')
  557.   do num = 1 to 10
  558.    call writech(stdout,'.')
  559.    do w = 1 to words(hits)
  560.     if word(hits,w) = let||num then do
  561.      s.let.num = ''pen3'X'def''
  562.      iterate num
  563.      end
  564.     end
  565.    do y = 1 to words(misses)
  566.     if word(misses,y) = let||num then do
  567.      s.let.num = ''pen2'*'def''
  568.      iterate num
  569.      end
  570.     end
  571.    s.let.num = ''pen6'.'def''
  572.    end
  573.   end
  574. return
  575.  
  576. setupdata:
  577.  if exists(datapath'/'name) then call delete(datapath'/'name)
  578.  /* Setup the random locations of the ships */
  579.  pos.c = ''
  580.  pos.b = ''
  581.  pos.d = ''
  582.  pos.s = ''
  583.  pos.p = ''
  584.  call setships C 6 5    /* Carrier */
  585.  call setships B 7 4    /* Battleship */
  586.  call setships D 8 3    /* Destroyer */
  587.  call setships S 8 3    /* Sub */
  588.  call setships P 9 2    /* PT Boat */
  589.  call open(data,datapath'/'name,'w')
  590.  call writeln(data,pos.c)  /* ship positions */
  591.  call writeln(data,pos.b)
  592.  call writeln(data,pos.d)
  593.  call writeln(data,pos.s)
  594.  call writeln(data,pos.p)
  595.  call writeln(data,'0')    /* # of hits on Carrier */
  596.  call writeln(data,'0')    /* # of hits on Battleship */
  597.  call writeln(data,'0')    /* # of hits on Destroyer */
  598.  call writeln(data,'0')    /* # of hits on Sub */
  599.  call writeln(data,'0')    /* # of hits on PT Boat */
  600.  call writeln(data,'0')    /* # of ships sunk so far */
  601.  call writeln(data,'')
  602.  call writeln(data,'')
  603.  call writeln(data,date())
  604.  call writeln(data,'0')
  605.  call close(data)
  606.  justsetup = 1
  607. return
  608.  
  609. setships:
  610.  arg shiptype spotlimit spots
  611.  starta = random(1,20,time('s'))
  612.  if starta > 0 & starta < 11 then direction = 'V'
  613.  else do
  614.   direction = 'H'
  615.   if starta = 11 then starta = 'A'
  616.   if starta = 12 then starta = 'B'
  617.   if starta = 13 then starta = 'C'
  618.   if starta = 14 then starta = 'D'
  619.   if starta = 15 then starta = 'E'
  620.   if starta = 16 then starta = 'F'
  621.   if starta = 17 then starta = 'G'
  622.   if starta = 18 then starta = 'H'
  623.   if starta = 19 then starta = 'I'
  624.   if starta = 20 then starta = 'J'
  625.   end
  626.  startb = random(1,spotlimit,time('s'))
  627.  if direction = 'V' then do
  628.   if startb = 1 then shstring = 'A B C D E F G H I J'
  629.   if startb = 2 then shstring = 'B C D E F G H I J'
  630.   if startb = 3 then shstring = 'C D E F G H I J'
  631.   if startb = 4 then shstring = 'D E F G H I J'
  632.   if startb = 5 then shstring = 'E F G H I J'
  633.   if startb = 6 then shstring = 'F G H I J'
  634.   if startb = 7 then shstring = 'G H I J'
  635.   if startb = 8 then shstring = 'H I J'
  636.   if startb = 9 then shstring = 'I J'
  637.   end
  638.  if direction = 'V' then do
  639.   do r = 1 to spots
  640.    let.r = word(shstring,r)
  641.    end
  642.   if shiptype = 'C' then pos.shiptype = ''let.1''starta' 'let.2''starta' 'let.3''starta' 'let.4''starta' 'let.5''starta''
  643.   if shiptype = 'B' then pos.shiptype = ''let.1''starta' 'let.2''starta' 'let.3''starta' 'let.4''starta''
  644.   if shiptype = 'D' | shiptype = 'S' then pos.shiptype = ''let.1''starta' 'let.2''starta' 'let.3''starta''
  645.   if shiptype = 'P' then pos.shiptype = ''let.1''starta' 'let.2''starta''
  646.   end
  647.  else do
  648.   if shiptype = 'C' then pos.shiptype = ''starta''startb' 'starta''startb + 1' 'starta''startb + 2' 'starta''startb +3' 'starta''startb + 4''
  649.   if shiptype = 'B' then pos.shiptype = ''starta''startb' 'starta''startb + 1' 'starta''startb + 2' 'starta''startb +3''
  650.   if shiptype = 'D' | shiptype = 'S' then pos.shiptype = ''starta''startb' 'starta''startb + 1' 'starta''startb + 2''
  651.   if shiptype = 'P' then pos.shiptype = ''starta''startb' 'starta''startb + 1''
  652.   end
  653.  
  654.  
  655. if shiptype ~= 'C' then do
  656.  do w = 1 to words(pos.shiptype)
  657.   testword = word(pos.shiptype,w)
  658.   do u = 1 to words(used)
  659.    usedword = word(used,u)
  660.    if testword = usedword then call setships shiptype spotlimit spots
  661.    end
  662.   end
  663.  end
  664. used = ''pos.c' 'pos.b' 'pos.d' 'pos.s' 'pos.p''
  665. return
  666.  
  667. /********************************************************************/
  668.  
  669. instring: procedure
  670. arg letter,string
  671.  if (index(string,letter) == 0) then return 0
  672.   else return 1
  673.  
  674. pressreturn:
  675. options prompt''pen5' Press return to continue'def''
  676. pull response
  677. return
  678.  
  679. SAC70:  /* SAY CENTER TEXT*/
  680. PARSE ARG string
  681. SAY CENTER(string,75)||CR
  682. RETURN;
  683.  
  684.  
  685. SYNTAX:
  686.    SAY '*BOOM*  Got a syntax error.  PLEASE notify the sysop.'
  687.    SAY 'Line:' SIGL '   Error Code:' RC
  688.  
  689. BREAK_C:
  690. BREAK_E:
  691. SAY
  692. exit