Update to include Royal Game of Ur

This commit is contained in:
William Moore 2024-09-27 10:55:04 -05:00
parent 7fc533f69d
commit 5004a851bb

68
TinyBASIC/ur.bas Normal file
View File

@ -0,0 +1,68 @@
10 REM ur.bas
11 REM Copyright (C) 2024 William R. Moore
12 REM
13 REM This program is free software: you can redistribute it and/or modify
14 REM it under the terms of the GNU General Public License as published by
15 REM the Free Software Foundation, either version 3 of the License, or
16 REM (at your option) any later version.
17 REM
18 REM This program is distributed in the hope that it will be useful,
19 REM but WITHOUT ANY WARRANTY; without even the implied warranty of
20 REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 REM GNU General Public License for more details.
22 REM
23 REM You should have received a copy of the GNU General Public License
24 REM along with this program. If not, see <http://www.gnu.org/licenses/>.
30 S1=0
31 S2=0
34 DIM B1(8),B2(8),B3(8),P1(27),P2(27)
40 FOR R=1 TO 8
41 B1(R)=0
42 NEXT
43 B1(2)=1
44 B1(7)=1
45 B1(3)=-1
46 B1(4)=-1
50 FOR R=1 TO 8
51 B2(R)=0
52 NEXT
53 B2(5)=1
60 FOR R=1 TO 8
61 B3(R)=0
62 NEXT
63 B3(2)=1
64 B3(7)=1
65 B3(3)=-1
66 B3(4)=-1
70 FOR R=1 TO 27
71 P1(R)=0
72 NEXT
80 FOR R=1 TO 27
81 P2(R)=0
82 NEXT
90 PRINT "WELCOME, TRAVELLER, TO THE TABLE OF THE ROYAL GAME OF UR"
100 GOSUB 900
105 PRINT
110 GOSUB 3000
120 END
900 REM PRINT OUT SCORE
910 PRINT "PLAYER 1 SCORE: ", S1
920 PRINT "PLAYER 2 SCORE: ", S2
930 RETURN
3000 REM PRINT OUT THE BOARD AND ALL BOARD PLACEMENTS
3010 PRINT "CURRENT BOARD:"
3020 FOR R=1 TO 8
3021 IF P1(R)=1 THEN PRINT "1", ELSE IF P2(R)=1 THEN PRINT "2", ELSE IF B1(R)<0 THEN PRINT " ", ELSE IF B1(R)=0 THEN PRINT ".", ELSE IF B1(R)=1 PRINT "R",
3022 NEXT
3023 PRINT
3030 FOR R=1 TO 8
3031 IF P1(R+8)=1 THEN PRINT "1", ELSE IF P2(R+8)=1 THEN PRINT "2", ELSE IF B2(R)=0 THEN PRINT ".", ELSE IF B2(R)=1 PRINT "R",
3032 NEXT
3033 PRINT
3040 FOR R=1 TO 8
3041 IF P1(R+8)=1 THEN PRINT "1", ELSE IF P2(R+8)=1 THEN PRINT "2", ELSE IF B1(R)<0 THEN PRINT " ", ELSE IF B3(R)=0 THEN PRINT ".", ELSE IF B3(R)=1 PRINT "R",
3042 NEXT
3043 PRINT
3050 RETURN