User Tools

Site Tools


en:office_battleships

OFFICE BATTLESHIPS

Info

Author John Filsak
Computer Amstrad PCW 8256 / 8512 / 9512
Year 1988
Gender Board
Controls Keyboard
Languages English
State Preserved

Screeshots

Description

It's half past four on a Friday afternoon in the heart of a busy city center. You, the boss of a large business company, tend to get quite bored just sitting there counting paper clips, so your joy is overwhelming when a message comes through your telex machine.

The message says:

Dear,

Would you be interested in a little game with me to pass the time? hours? If so, turn on your computer and log in to your company's mainframe: 1K97 user area.

Sincerely, A. Rival.

After following these instructions, you are now sitting at your computer terminal and logged in. The screen displays two grids and you are prompted to enter the locations of various pieces of furniture in your office. Only now do you realize that you are playing a version of the Battleships game, and your opponent starts the game by giving you a grid reference and asking if he scored a hit or a miss.

If it is a hit, you will be prompted to enter a value corresponding to the furniture hit. Once this is done, or if your opponent missed, you are prompted to enter a grid reference to attempt to hit your opponent's team. The central computer, which keeps track of the game, will tell you if a hit was scored.

The game continues until one of the offices is completely empty and the winner is announced. Be careful though, the mainframe will stop the game if you cheat.

Listing

  • Listing - OFFICEBA.BAS
10 REM        Office Battleships
20 REM          by John Filsak
30 REM (c) Computing with the Amstrad 
40 REM ------------ PCW -------------
50 RANDOMIZE PEEK(64504!):e$=CHR$(27):cls$=e$+"E"+e$+"H":ron$=e$+"p":rof$=e$+"q"
60 uon$=e$+"r":DEFINT a-z:uof$=e$+"u" 
70 cof$=e$+"f":con$=e$+"e"
80 DEF FNat$(x,y)=e$+"Y"+CHR$(x+32)+CHR$(y+32)
90 DIM h(6),h1(6),a$(6),p0$(9,9),p1$(9,9),p2$(9,9),p3$(9,9),na$(6)
100 GOSUB 1740:PRINT cof$:k=1:WHILE k=1 
110 PRINT cls$;ron$;" OFFICE-BATTLESHIPS "rof$;" Please wait while I arrange my furniture."
120 GOSUB 1790:GOSUB 180:GOSUB 630 
130 GOSUB 350:GOSUB 840:GOSUB 1860 
140 PRINT FNat$(30,0);"Play again? Y/N"
150 ans$="YN":GOSUB 1840
160 WEND:PRINT cls$;con$:END
170 REM Opponent's furniture
180 FOR a=6 TO 0 STEP-1:z=(RND*2)+1 
190 ON z GOSUB 210,280:NEXT:RETURN 
200 REM Vertical
210 x=(RND*10)-a:IF x<0 THEN 210 
220 y=(RND*9):b=0
230 IF x+b>9 THEN 210
240 IF p0$(x+b,y)="L" OR p0$(x+b,y)="P" OR p0$(x+b,y)="D" OR p0$(x+b,y)="T" OR p0$(x+b,y)="F" OR p0$(x+b,y)="C" THEN 210
250 b=b+1:IF b<=a THEN 230
260 FOR c=0 TO a:p0$(x+c,y)=a$(a):NEXT:RETURN
270 REM Horizontal
280 y=(RND*10)-a:IF y<0 THEN 280 
290 x=(RND*9):b=0
300 IF y+b>9 THEN 280
310 IF p0$(x,y+b)="L" OR p0$(x,y+b)="P" OR p0$(x,y+b)="D" OR p0$(x,y+b)="T" OR p0$(x,y+b)="F" OR p0$(x,y+b)="C" THEN 280 
320 b=b+1:IF b<=a THEN 300
330 FOR c=0 TO a:p0$(x,y+c)=a$(a):NEXT:RETURN
340 REM Players furniture
350 PRINT FNat$(17,0);"My furniture is in position."
360 PRINT:PRINT"Now you position yours." 
370 PRINT:PRINT"Press a key to continue.":WHILE INKEY$="":WEND
380 FOR a=6 TO 0 STEP-1:GOSUB 1820
390 PRINT FNat$(17,0);"Where would you like to position your ";na$(a);" (";
400 FOR z=0 TO a:PRINT a$(a);:NEXT:PRINT")?":PRINT "X co-ordinate (0 to 9) ?";
410 GOSUB 1830:x=k-1:PRINT x
420 PRINT"Y co-ordinate (0 to 9) ?"; 
430 GOSUB 1830:y=k-1:PRINT y
440 IF a>0 THEN PRINT"Horizontal or Vertical ?";:ans$="HV":GOSUB 1840:PRINT MID$(ans$,k,1)
450 IF k=1 THEN 520
460 REM Vertical
470 b=0:IF x+a>9 THEN GOSUB 600:GOTO 390 
480 IF p1$(x+b,y)="L" OR p1$(x+b,y)="S" OR p1$(x+b,y)="D" OR p1$(x+b,y)="T" OR p1$(x+b,y)="F" OR p1$(x+b,y)="C" THEN GOSUB 600:GOTO 390
490 b=b+1:IF b<=a THEN 480
500 FOR c=0 TO a:p1$(x+c,y)=a$(a):NEXT:GOTO 560
510 REM Horizontal
520 b=0:IF y+a>9 THEN GOSUB 600:GOTO 390 
530 IF p1$(x,y+b)="L" OR p1$(x,y+b)="S" OR p1$(x,y+b)="D" OR p1$(x,y+b)="T" OR p1$(x,y+b)="F" OR p1$(x,y+b)="C" THEN GOSUB 600:GOTO 390
540 b=b+1:IF b<=a THEN 530
550 FOR c=0 TO a:p1$(x,y+c)=a$(a):NEXT 
560 FOR p=0 TO 9:FOR q=0 TO 9
570 IF p1$(p,q)<>"" THEN PRINT FNat$(13-p,4+q*2);p1$(p,q)
580 NEXT:NEXT:NEXT:GOSUB 1820
590 d$="Your":x=2:y=27:GOSUB 810:RETURN 
600 GOSUB 1820:PRINT FNat$(17,0);CHR$(7);"It won't fit there."
610 GOSUB 1860:RETURN
620 REM Draw grids
630 PRINT FNat$(0,0);ron$;SPC(89);rof$ 
640 title$="* * * O F F I C E - B A T T L E S H I P S * * *"
650 PRINT FNat$(0,(89-LEN(title$))/2);ron$;title$;rof$
660 PRINT FNat$(2,7);ron$;" YOUR OFFICE "rof$;
670 PRINT FNat$(8,0);"X";FNat$(15,13);"Y" 
680 FOR a=0 TO 9:PRINT FNat$(13-a,1);a 
690 PRINT FNat$(13-a,46);a
700 PRINT FNat$(14,3+a*2);a
710 PRINT FNat$(14,48+a*2);a
720 FOR b=0 TO 9
730 PRINT FNat$(13-a,4+b*2);":"
740 PRINT FNat$(13-a,49+b*2);":":NEXT:NEXT
750 PRINT FNat$(2,53);ron$;" MY OFFICE ";rof$
760 PRINT FNat$(8,45);"X";FNat$(15,58);"Y"
770 d$="My":x=2:y=72:GOSUB 810:RETURN
780 FOR a=0 TO 9:FOR b=0 TO 9
790 IF p0$(a,b)="" THEN PRINT FNat$(13-a,49+b*2);":" ELSE PRINT FNat$(13-a,49+b*2);p0$(a,b)
800 NEXT:NEXT:RETURN
810 PRINT FNat$(x,y);uon$;d$;" objects";uof$;FN at$(x+1,y);uon$;"not destroyed:";uof$
820 FOR g=0 TO 6:n$=na$(g):n$=UPPER$(LEFT$(n$,1))+RIGHT$(n$,LEN(n$)-1)
830 PRINT FNat$(x+g+4,y);n$:NEXT:RETURN 
840 REM Your go or opponent's go?
850 PRINT FNat$(16,0);
860 PRINT"Press a key":WHILE INKEY$="":WEND
870 go=0:empty=0:empty1=0:WHILE empty=0 AND empty1=0
880 go=go+1:IF go/2<>INT(go/2) THEN GOSUB 1190 ELSE GOSUB 950
890 WEND
900 IF empty=1 THEN PRINT FNat$(17,0);CHR$(7);"You have destroyed all my furniture. I surrender"
910 IF empty1=1 THEN PRINT FNat$(17,0);CHR$(7);"I have destroyed all your furniture. You have lost.":GOSUB 1860
920 PRINT:PRINT"Would you like to see where all furniture was ? (Y/N)":ans$="YN":GOSUB 1840:IF k=1 THEN GOSUB 780
930 RETURN
940 REM Your go
950 PRINT:PRINT"Type the co-ordinates of the spot you want to blast."
960 PRINT"X co-ordinate (0-9) ?";:GOSUB 1830:x=k-1:PRINT x
970 PRINT"Y co-ordinate (0-9) ?";:GOSUB 1830:y=k-1:PRINT y
980 GOSUB 1820:empty$="":hit$=""
990 IF p2$(x,y)<>"" THEN PRINT FNat$(17,0);CHR$(7);"You have already tried that postion. Pick another.":GOTO 950
1000 p2$(x,y)=p0$(x,y)
1010 IF p2$(x,y)="" THEN p2$(x,y)="*":PRINT FNat$(17,0);"Missed!"
1020 FOR z=6 TO 0 STEP-1
1030 IF p2$(x,y)=a$(z) THEN hit$=na$(z):h(z)=h(z)-1
1040 NEXT
1050 IF hit$<>"" THEN PRINT FNat$(17,0);"You hit my ";hit$;".":GOSUB 1850
1060 FOR z=6 TO 0 STEP-1
1070 IF hit$=na$(z) AND h(z)=0 THEN PRINT CHR$(7):PRINT"You have destroyed my ";hit$".":empty$=UPPER$(LEFT$(hit$,1)):GOSUB 1850
1080 NEXT
1090 FOR i=0 TO 9:FOR j=0 TO 9
1100 IF empty$<>"" THEN IF p0$(i,j)=empty$ THEN p2$(i,j)="$"
1110 NEXT:NEXT
1120 IF empty$<>"" THEN PRINT FNat$(6+INSTR(initial$,empty$)-1,72);SPACE$(16) 
1130 FOR i=0 TO 9:FOR j=0 TO 9
1140 IF p2$(i,j)<>"" THEN PRINT FNat$(13-i,49+j*2);p2$(i,j)
1150 NEXT:NEXT
1160 IF h(6)=0 AND h(5)=0 AND h(4)=0 AND h(3)=0 AND h(2)=0 AND h(1)=0 AND h(0)=0 THEN GOSUB 1820:empty=1:RETURN
1170 GOSUB 1820:PRINT FNat$(17,0);"Now is my turn.":RETURN
1180 REM Opponent's go
1190 check=0:GOSUB 1580
1200 IF check=1 THEN GOSUB 1620:GOTO 1220
1210 xx=INT(RND*10):yy=INT(RND*10):IF p3$(xx,yy)<>"" THEN 1210
1220 PRINT:PRINT"I am aiming a shot at your grid position X";xx;", Y;yy
1230 PRINT:PRINT"Is it a hit or a miss? (H/M)"
1240 k=0:k$="":WHILE k=0 OR k$=""
1250 IF p1$(xx,yy)="" THEN PRINT FNat$(13-xx,4+yy*2);":":GOSUB 1850 ELSE PRINT FNat$(13-xx,4+yy*2);p1$(xx,yy):GOSUB 1850 
1260 IF p1$(xx,yy)="" THEN PRINT FNat$(13-xx,4+yy*2);ron$;":";rof$:GOSUB 1850 ELSE PRINT FNat$(13-xx,4+yy*2);ron$;p1$(xx,yy);rof$:GOSUB 1850
1270 k$=UPPER$(INKEY$):k=INSTR("HM",k$):WEND:GOSUB 1820
1280 IF k=2 THEN c$="":PRINT"Please confirm: I have missed. (Y/N)":ans$="YN":GOSUB 1840:IF k=2 THEN GOSUB 1820:GOTO 1230 ELSE 1350
1290 IF k=1 THEN GOSUB 1380
1300 IF k=11 AND k1=7 THEN c$="":GOTO 1350
1310 IF k=11 THEN h1(k1)=h1(k1)-1
1320 IF k=12 THEN PRINT:PRINT"Have I hit or missed?  (H/M)":GOTO 1240
1330 IF c$="hit" THEN p3$(xx,yy)="#" :GOSUB 1480
1340 IF h1(k1)=0 THEN GOSUB 1510
1350 IF c$="" THEN p3$(xx,yy)="*":GOSUB 1480
1360 GOSUB 1820:IF empty1=0 THEN PRINT FNat$(17,0);"Now its your turn."
1370 RETURN
1380 c$="hit":PRINT"What have I hit?"
1390 FOR g=0 TO 7:IF g=7 THEN n$="nothing" ELSE n$=na$(g)
1400 n$=UPPER$(LEFT$(n$,1))+RIGHT$(n$,LEN(n$)-1)
1410 PRINT TAB(4)g+1;") ";n$:NEXT
1420 PRINT "Type the number corresponding to the vessel I have hit. ";
1430 ans$="12345678":GOSUB 1840:k1=k-1:GOSUB 1820
1440 IF k=8 THEN PRINT FNat$(17,0);"Please confirm: I have missed.  (Y/N)"
1450 IF k<8 THEN IF h1(k1)=0 THEN PRINT CHRS(7)"Don't be daft. Your ";na$(k1);" is at the bottom of the sea!":GOSUB 1860:GOSUB 1820:GOTO 1380
1460 IF k<8 THEN PRINT FNat$(17,0);"Please confirm: I have hit your ";na$(k1)". (Y/N)"
1470 ans$="YN":GOSUB 1840:k=k+10:RETURN 
1480 FOR p=0 TO 9:FOR q=0 TO 9
1490 IF p3$(p,q)<>"" THEN PRINT FNat$(13-p,4+q*2);p3$(p,q)
1500 NEXT:NEXT:RETURN
1510 PRINT FNat$(20,0);CHR$(7);"I have destroyed your ";na$(k1)
1520 down=0:FOR i=0 TO 9:FOR j=0 TO 9 
1530 IF p1$(i,j)=a$(k1) THEN p3$(i,j)="$"
1540 NEXT:NEXT
1550 PRINT FNat$(6+k1,27);SPACE$(16):GOSUB 1480
1560 IF h1(0)=0 AND h1(1)=0 AND h1(2)=0 AND h1(3)=0 AND h1(4)=0 AND h1(5)=0 AND h1(6)=0 THEN GOSUB 1820:empty1=1
1570 RETURN
1580 FOR i=0 TO 9:FOR j=0 TO 9
1590 IF p3$(i,j)="#" THEN check=1:RETURN 
1600 NEXT:NEXT:RETURN
1610 REM Calculate move after hit scored 
1620 IF down=1 THEN 1700
1630 IF j+1<10 THEN xx=i:yy=j+1:IF p3$(xx,yy)="" THEN RETURN
1640 FOR t=2 TO 9:IF p3$(xx,yy)="#" AND xx=i THEN IF j+t<10 THEN yy=j+t:IF p3$(xx,yy)="" THEN RETURN
1650 NEXT
1660 IF j-1>=0 AND xx=i THEN yy=j-1:IF p3$(xx,yy)="" THEN RETURN
1670 IF i+1<10 THEN yy=j:xx=i+1:IF p3$(xx,yy)=""THEN RETURN
1680 FOR t=2 TO 9:IF p3$(xx,yy)="#" AND yy=j THEN IF i+t<10 THEN xx=i+t:IF p3$(xx,yy)="" THEN RETURN
1690 NEXT
1700 IF i-1>=0 THEN yy=j:xx=i-1:IF p3$(xx,yy)="" THEN down=1:RETURN
1710 PRINT FNat$(9,0);CHR$(7);ron$;"I can't find your furniture."
1720 PRINT " You must have made a mistake. Please start again.";rof$;con$:END 
1730 REM Assorted subroutines
1740 FOR a=0 TO 6:READ na$(a):NEXT
1750 initial$="HCFTDPL":FOR a=0 TO 6:a$(a)=MID$(initial$,a+1,1):NEXT:RETURN
1760 DATA hat stand,chair,filing cabinet 
1770 DATA telex machine,drinks cabinet 
1780 DATA photocopier,large oak desk 
1790 FOR a=0 TO 6:h(a)=a+1:h1(a)=a+1 
1800 NEXT:FOR a=0 TO 9:FOR b=0 TO 9
1810 p0$(a,b)="":p1$(a,b)="":p2$(a,b)="":p3$(a,b)="":down=0:NEXT:NEXT:RETURN 
1820 PRINT FNat$(17,0);e$+"J":RETURN
1830 ans$="0123456789"
1840 k=0:k$="":WHILE k=0 OR k$="":k$=UPPER$(INKEY$):k=INSTR(ans$,k$):WEND:RETURN 
1850 FOR temp=1 TO 800:NEXT:RETURN
1860 FOR temp=0 TO 2500:NEXT:RETURN

Controls

       Through the information on the screen.

Loading the program

 1.- Insert the CP/M disc on side 2
 2.- Write BASIC and wait for it to load
 3.- Remove the CP/M disk and insert the disk containing the Office Battleships game
 4.- Type run "OFFICEBA" and press the "ENTER" key

Extras

  • Listing of the program in a magazine with a large circulation of the time

office_battleships_01.jpg office_battleships_02.jpg office_battleships_03.jpg

Download

en/office_battleships.txt · Last modified: 2022/06/30 00:26 by jevicac