Updates to Ship, Captain, Crew impls

This commit is contained in:
William Moore 2023-08-05 22:39:22 -05:00
parent 311b3d627a
commit 64fa6a8f02
2 changed files with 64 additions and 107 deletions

View File

@ -13,120 +13,77 @@
13 REM
14 REM You should have received a copy of the GNU General Public License
15 REM along with this program. If not, see <http://www.gnu.org/licenses/>.
20 REM R, S, T, U, V ARE DIFF DICE
21 DEFINT R
22 DEFINT S
23 DEFINT T
24 DEFINT U
25 DEFINT V
30 REM H, C, D ARE
31 REM SHIP, CAPT, CREW
32 OUT(0,4,0)
40 H=0:C=0:D=0
50 REM I IS INP, G IS TURNS
60 I=0:R=0:S=0:T=0:U=0:V=0:G=0:E=0:J=0
50 DIM D(5)
55 H=0:C=0:K=0
60 I=0:G=0:E=0:J=0:B=0
61 FOR P=1 TO 5
62 D(P)=0
63 NEXT P
100 REM INPUT LOOP
110 I=INP(0,4)
120 IF I <> 128 GOTO 110
121 GOSUB 7000
110 PRINT "TOGGLE SWITCHES AND ENTER ANY KEY TO CONTINUE..."
120 INPUT X$
130 I=INP(0,4)
140 IF I=2 E=1:J=0:GOSUB 3000
141 IF I=3 J=1:GOSUB 3000
150 IF I=1 IF G<3 J=0:GOSUB 2000:G=G+1
160 IF G=3 E=1:J=0:GOSUB 3000
161 IF I=128 GOTO 40
170 WAIT(200)
180 GOTO 130
140 IF I=1 GOSUB 2000:G=G+1
150 IF I=2 PRINT "GAME OVER! YOU SCORED: ", B:GOSUB 8000:END
151 IF G=3 PRINT "GAME OVER! YOU SCORED: ", B:GOSUB 8000:END
160 IF H=1 IF C=1 IF K=1 B=0:GOSUB 7000
170 GOTO 110
1000 IF H=0 GOSUB 6000:GOSUB 5000
1001 IF H=0 RETURN
1010 IF H=1 GOSUB 1040
1010 IF H=1 GOSUB 1050
1020 IF C=0 RETURN
1030 IF D=0 RETURN
1030 IF K=0 RETURN
1040 RETURN
1050 IF C=0 GOSUB 6050:GOSUB 5060
1060 IF C=0 RETURN
1070 IF C=1 IF D=0 GOSUB 6100:GOSUB 5120
1070 IF C=1 IF K=0 GOSUB 6100:GOSUB 5120
1080 RETURN
2000 GOSUB 1000
2010 IF R > -1 R = RND(6)
2020 IF S > -1 S = RND(6)
2030 IF T > -1 T = RND(6)
2040 IF U > -1 U = RND(6)
2050 IF V > -1 V = RND(6)
2060 GOSUB 4000
2070 RETURN
3000 IF J=0 GOSUB 4000
3010 OUT(0, 4, O)
3020 IF I=0 IF G=3 GOTO 40
3021 RETURN
2000 FOR P=1 TO 5
2001 DEFINT A
2002 A=RND(6)
2010 IF D(P) > -1 D(P)=A
2020 NEXT P
2030 GOSUB 1000
2040 GOSUB 4000
2050 RETURN
4000 L=0
4001 IF H = 1 L = L + 4
4002 IF C = 1 L = L + 2
4003 IF D = 1 L = L + 1
4010 IF J=0 O=0
4020 IF R >= 0 O = O + R
4030 IF S >= 0 O = O + S
4040 IF T >= 0 O = O + T
4050 IF U >= 0 O = O + U
4060 IF V >= 0 O = O + V
4061 IF E=1 IF L=7 O=O+128
4070 IF L<8 IF I=2 O = 64
4080 IF L<8 IF G=3 O = 64
4081 IF J=0 IF E=0 IF I<>3 OUT(0, 4, L)
4082 IF J=0 IF E=0 IF I<>3 OUT(0, 4, L)
4090 RETURN
5000 IF R = 5 R = -1:RETURN
5010 IF S = 5 S = -1:RETURN
5020 IF T = 5 T = -1:RETURN
5030 IF U = 5 U = -1:RETURN
5040 IF V = 5 V = -1:RETURN
4001 IF H=1 PRINT "SHIP"
4002 IF C=1 PRINT "CAPTAIN"
4003 IF K=1 PRINT "CREW"
4010 O=0
4020 FOR P=1 TO 5
4030 IF D(P) > -1 O=O+D(P)+1
4040 NEXT P
4050 PRINT "TOTAL: ", O
4060 RETURN
5000 FOR P=1 TO 5
5010 IF D(P)=5 D(P)=-1:EXIT 5050
5020 NEXT P
5050 RETURN
5060 IF R = 4 R = -1:RETURN
5070 IF S = 4 S = -1:RETURN
5080 IF T = 4 T = -1:RETURN
5090 IF U = 4 U = -1:RETURN
5100 IF V = 4 V = -1:RETURN
5110 RETURN
5120 IF R = 3 R = -1:RETURN
5130 IF S = 3 S = -1:RETURN
5140 IF T = 3 T = -1:RETURN
5150 IF U = 3 U = -1:RETURN
5160 IF V = 3 V = -1:RETURN
5170 RETURN
6000 IF R=5 H=1:RETURN
6010 IF S=5 H=1:RETURN
6020 IF T=5 H=1:RETURN
6030 IF U=5 H=1:RETURN
6040 IF V=5 H=1:RETURN
6041 RETURN
6050 IF R=4 C=1:RETURN
6060 IF S=4 C=1:RETURN
6070 IF T=4 C=1:RETURN
6080 IF U=4 C=1:RETURN
6090 IF V=4 C=1:RETURN
6091 RETURN
6100 IF R=3 D=1:RETURN
6110 IF S=3 D=1:RETURN
6120 IF T=3 D=1:RETURN
6130 IF U=3 D=1:RETURN
6140 IF V=3 D=1:RETURN
7000 N=129
7010 OUT (0,4,N)
7020 WAIT(8)
7030 N=66
7040 OUT (0,4,N)
7050 WAIT(8)
7060 N=36
7070 OUT (0,4,N)
7080 WAIT(8)
7090 N=24
7100 OUT (0,4,N)
7110 WAIT(8)
7120 N=36
7130 OUT (0,4,N)
7140 WAIT(8)
7150 N=66
7160 OUT (0,4,N)
7170 WAIT(8)
7180 OUT (0,4,0)
7190 RETURN
5060 FOR P=1 TO 5
5070 IF D(P)=4 D(P)=-1:EXIT 5090
5080 NEXT P
5090 RETURN
5120 FOR P=1 TO 5
5130 IF D(P)=3 D(P)=-1:EXIT 5150
5140 NEXT P
5150 RETURN
6000 FOR P=1 TO 5
6010 IF D(P)=5 H=1:EXIT 6030
6020 NEXT P
6030 RETURN
6050 FOR P=1 TO 5
6060 IF D(P)=4 C=1:EXIT 6080
6070 NEXT P
6080 RETURN
6100 FOR P=1 TO 5
6120 IF D(P)=3 K=1:EXIT 6140
6130 NEXT P
6140 RETURN
7000 B=0
7010 FOR P=1 TO 5
7020 IF D(P)>=0 B=B+D(P)+1
7030 NEXT P
7040 RETURN
8000 IF H=1 IF C=1 IF K=1 GOSUB 7000
8010 RETURN

View File

@ -19,7 +19,7 @@
40 RANDOMIZE(0)
50 DIM D(5)
55 H=0:C=0:D=0
50 REM I IS INP, G IS TURNS
56 REM I IS INP, G IS TURNS
60 I=0:D(1)=0:D(2)=0:D(3)=0:D(4)=0:D(5)=0:G=0:E=0:J=0:B=0
100 REM INPUT LOOP
110 PRINT "PRESS ANY KEY TO CONTINUE..."