BATTLE
Battleship for the calc. After the title screen you will see a grid and a message saying "PLACE SHIP 1", use the arrow keys to move the blinking ? mark to where you want the top, left corner of the ship, then press ENTER. It now asks "DOWN=1 OVER=2", press 1 if you want the ship to go down from where you pressed ENTER, or 2 if you want it to go over. This is repeated for all 5 ships. If you should try to place a ship where it would go off the playing screen, or overlap another ship you see "BAD SPOT", and must replace that ship. The ships are 2,2,3,4,5 grid points in length. After placing all you ships you will see "ONE MOMENT PLEASE" while the calc sets up its ships. You should now see a grid with "HITS" and "OUCHES" to the side. Use the arrow keys to move the blinking ? mark, and press ENTER to fire a shot. A message is shown below the "OUCHES" counter, it says "HIT!!", "MISS", or "OUCH!" depending on what happened. If you hit one of the calcs ships it says "HIT", if you miss "MISS", if the calc hits you an "OUCH!" appaers. The HIT counter counts how many hits you've made, the OUCH counter counts how many hits the calc has made. When it is your turn, you can press the 2nd key for a menu. The menu has these items: View Ships, Continue, Quit. View Ships lets you see your ships and the hits/misses of the calc, press ENTER to resume play. Continue goes back, and Quit quits. When you have hit all the calcs ships or the calc hits all of yours, the game is over and the winner is displayed at the bottom. This is free software released under the GNU General Public License. There is no warranty for this software. Copyright 1995 Mike Tilstra \START82\
\COMMENT=Battle 1.1.0 by Mike Tilstra
\NAME=BATTLE
\FILE=BATTLE.82p
ClrHome
For(X,1,8)
Output(X,2,"MIKE TILSTRA'S")
For(Y,1,37):End
ClrHome
End
For(X,8,1,\(-)\1)
Output(X,4,"BATTLESHIP")
For(Y,1,37):End
ClrHome
End
Output(1,4,"BATTLESHIP")
Output(2,7,"1.1.0")
Output(7,8,"BY")
Output(8,3,"MIKE TILSTRA")
Pause
ClrHome
{6,7}\->\dim [D]
{6,7}\->\dim [E]
Fill(0,[D])
Fill(0,[E])
Normal:Float
FullScreen
0\->\H:0\->\M
0\->\I:0\->\N
For(X,2,7)
For(Y,2,8)
Output(X,Y,".")
End
End
For(A,1,5)
getKey
Output(1,10,"PLACE ")
Output(2,10,"SHIP ")
Output(2,15,A)
Lbl 1
0\->\Y
1\->\G:2\->\C:2\->\D
While G=1
0\->\K
getKey\->\K
If K=24
C-1\->\C
If K=26
C+1\->\C
If K=25
D-1\->\D
If K=34
D+1\->\D
If D\>=\8
7\->\D
If D\<=\1
2\->\D
If C\>=\9
8\->\C
If C\<=\1
2\->\C
If K=105
0\->\G
Output(D,C,"?")
For(X,1,50):End
[D](D-1,C-1)\->\X
If X=0
Output(D,C,".")
If X\>=\1 and X\<=\4
Output(D,C,"+")
End
Output(1,10,"DOWN=1")
Output(2,10,"OVER=2")
1\->\G:1\->\V
While G=1
0\->\K
getKey\->\K
If K=92
Then
1\->\V:0\->\G
End
If K=93
Then
2\->\V:0\->\G
End
End
D-1\->\D
C-1\->\C
A\->\B
If B=1
2\->\B
If V=1 and (D\<=\0 or D>(7-B))
Then
Output(1,10,"BAD ")
Output(2,10,"SPOT ")
1\->\Y
End
If V=2 and (C\<=\0 or C>(8-B))
Then
Output(1,10,"BAD ")
Output(2,10,"SPOT ")
1\->\Y
End
If Y=1
Goto 1
If V=1
Then
For(\@\,D,B+D-1)
[D](\@\,C)\->\Z
If Z\<>\0
Then
Output(1,10,"BAD ")
Output(2,10,"SPOT ")
1\->\Y
End
End
Else
For(\@\,C,B+C-1)
[D](D,\@\)\->\Z
If Z\<>\0
Then
Output(1,10,"BAD ")
Output(2,10,"SPOT ")
1\->\Y
End
End
End
If Y=1
Goto 1
If V=1
Then
For(\@\,D,B+D-1)
A\->\[D](\@\,C)
Output(\@\+1,C+1,"+")
End
Else
For(\@\,C,B+D-1)
A\->\[D](D,\@\)
Output(D+1,\@\+1,"+")
End
End
End

Output(1,10,"ONE ")
Output(2,10,"MOMENT")
Output(3,10,'PLEASE")
For(A,5,1,\(-)\1)
Lbl 2
0\->\Y
int 6rand+1\->\D
int 7rand+1\->\C
int 2rand+1\->\V
A\->\B
If B=1
2\->\B
If V=1 and (D\<=\0 or D>(7-B))
Goto 2
If V=2 and (C\<=\0 or C>(8-B))
Goto 2
If V=1
Then
For(\@\,D,B+D-1)
[E](\@\,C)\->\Z
If Z\<>\0
1\->\Y
End
Else
For(\@\,C,B+C-1)
[E](D,\@\)\->\Z
If Z\<>\0
1\->\Y
End
End
If Y=1
Goto 2
If V=1
Then
For(\@\,D,B+D-1)
A\->\[E](\@\,C)
End
Else
For(\@\,C,B+C-1)
A\->\[E](D,\@\)
End
End
End
ClrHome
For(D,2,7)
For(C,2,8)
Output(D,C,".")
End
End
Output(1,10,"HITS")
Output(2,13,H)
Output(3,10,"OUCHES")
Output(4,13,I)
0\->\C:0\->\D
Lbl P
1\->\G
While G=1
0\->\K
getKey\->\K
If K=24
C-1\->\C
If K=26
C+1\->\C
If K=25
D-1\->\D
If K=34
D+1\->\D
If C\>=\9
8\->\C
If C\<=\1
2\->\C
If D\>=\8
7\->\D
If D\<=\1
2\->\D
Output(D,C,"?")
For(\@\,1,51):End
[E](D-1,C-1)\->\\@\
If \@\=8
Output(D,C,"O")
If \@\=9
Output(D,C,"*")
If \@\<8
Output(D,C,".")
If K=105
0\->\G
If K=21
Menu("OPTIONS","VIEW SHIPS",5,"CONTINUE",6,"QUIT",7)
Lbl 6
End
0\->\Z
If [E](D-1,C-1)>7
Then
Output(5,10,"ALREADY")
Output(6,10,"THERE")
1\->\Z
End
If Z=1
Goto P
If [E](D-1,C-1)\<>\0
Then
Output(5,10," HIT!! ")
Output(D,C,"*")
9\->\[E](D-1,C-1)
H+1\->\H
Output(2,13,H)
Else
Output(5,10,"MISS ")
Output(D,C,"O")
8\->\[E](D-1,C-1)
M+1\->\M
End
Lbl Z
int 6rand+1\->\X
int 7rand+1\->\Y
If [D](X,Y)>7
Goto Z
If [D](X,Y)\<>\0
Then
Output(5,10,"OUCH! ")
9\->\[D](X,Y)
I+1\->\I
Output(4,13,I)
Else
8\->\[D](X,Y)
N+1\->\N
End
If H=16
Then
Output(8,4,"YOU'VE WON!!")
Return
Stop
End
If I=16
Then
Output(8,4,"CALC WON")
Return
Stop
End
Goto P
Lbl 5
For(D,2,7)
For(C,2,8)
[D](D-1,C-1)\->\\@\
Output(D,C,"."
If \@\\>=\1 and \@\\<=\5
Output(D,C,"+"
If \@\=8
Output(D,C,"O"
If \@\=9
Output(D,C,"*"
End
End
Pause
getKey
For(D,2,7
For(C,2,8
[E](D-1,C-1)\->\\@\
Output(D,C,"."
If \@\=8
Output(D,C,"O"
If \@\=9
Output(D,C,"*"
End
End
Goto 6
Lbl 7
Stop
MIKE TILSTRA
\STOP82\