mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-18 08:06:27 -05:00
88 lines
2.1 KiB
QBasic
88 lines
2.1 KiB
QBasic
5 PRINT
|
|
10 PRINT "SOLITAIRE CHECKER PUZZLE BY DAVID AHL"
|
|
15 PRINT
|
|
20 PRINT "48 CHECKERS ARE PLACED ON THE 2 OUTSIDE SPACES OF A"
|
|
25 PRINT "STANDARD 64-SQUARE CHECKERBOARD. THE OBJECT IS TO"
|
|
30 PRINT "REMOVE AS MANY CHECKERS AS POSSIBLE BY DIAGONAL JUMPS"
|
|
35 PRINT "(AS IN STANDARD CHECKERS). USE THE NUMBERED BOARD TO"
|
|
40 PRINT "INDICATE THE SQUARE YOU WISH TO JUMP FROM AND TO. ON"
|
|
45 PRINT "THE BOARD PRINTED OUT ON EACH TURN '1' INDICATES A"
|
|
50 PRINT "CHECKER AND '0' AN EMPTY SQUARE. WHEN YOU HAVE NO"
|
|
55 PRINT "POSSIBLE JUMPS REMAINING, INPUT A '0' IN RESPONSE TO"
|
|
60 PRINT "QUESTION 'JUMP FROM ?'"
|
|
62 PRINT
|
|
63 PRINT "HERE IS THE NUMERICAL BOARD:"
|
|
66 PRINT
|
|
68 DIM A(64)
|
|
70 FOR J=1 TO 57 STEP 8
|
|
72 FOR I=0 TO 7
|
|
73 PRINT TAB(4*I);J+I;
|
|
74 NEXT I
|
|
75 PRINT
|
|
76 NEXT J
|
|
77 PRINT
|
|
78 PRINT "AND HERE IS THE OPENING POSITION OF THE CHECKERS:"
|
|
79 PRINT
|
|
80 FOR J=1 TO 64
|
|
82 A(J)=1
|
|
84 NEXT J
|
|
86 FOR J=19 TO 43 STEP 8
|
|
88 FOR I=J TO J+3
|
|
90 A(I)=0
|
|
92 NEXT I
|
|
94 NEXT J
|
|
96 M=0
|
|
98 GOTO 340
|
|
100 PRINT "JUMP FROM";\INPUT F
|
|
105 IF F=0 THEN 500
|
|
110 PRINT "TO";\INPUT T
|
|
112 PRINT
|
|
118 REM *** CHECK LEGALITY OF MOVE
|
|
120 F1=INT((F-1)/8)
|
|
130 F2=F-8*F1
|
|
140 T1=INT((T-1)/8)
|
|
150 T2=T-8*T1
|
|
160 IF F1>7 THEN 230
|
|
170 IF T1>7 THEN 230
|
|
180 IF F2>8 THEN 230
|
|
190 IF T2>8 THEN 230
|
|
200 IF ABS(F1-T1)<>2 THEN 230
|
|
210 IF ABS(F2-T2)<>2 THEN 230
|
|
212 IF A((T+F)/2)=0 THEN 230
|
|
215 IF A(F)=0 THEN 230
|
|
220 IF A(T)=1 THEN 230
|
|
225 GOTO 250
|
|
230 PRINT "ILLEGAL MOVE. TRY AGAIN..."
|
|
240 GOTO 100
|
|
245 REM *** UPDATE BOARD
|
|
250 A(T)=1
|
|
260 A(F)=0
|
|
270 A((T+F)/2)=0
|
|
290 M=M+1
|
|
310 REM *** PRINT BOARD
|
|
340 FOR J=1 TO 57 STEP 8
|
|
350 FOR I=J TO J+7
|
|
360 PRINT A(I);
|
|
370 NEXT I
|
|
380 PRINT
|
|
390 NEXT J
|
|
400 PRINT
|
|
410 GOTO 100
|
|
490 REM *** END GAME SUMMARY
|
|
500 S=0
|
|
510 FOR I=1 TO 64
|
|
520 S=S+A(I)
|
|
530 NEXT I
|
|
535 PRINT
|
|
540 PRINT "YOU MADE"M"JUMPS AND HAD"S"PIECES"
|
|
550 PRINT "REMAINING ON THE BOARD."
|
|
560 PRINT
|
|
562 PRINT "TRY AGAIN";\INPUT A$
|
|
570 IF A$="YES" THEN 70
|
|
575 IF A$="NO" THEN 600
|
|
580 PRINT "PLEASE ANSWER 'YES' OR 'NO'."
|
|
590 GOTO 562
|
|
600 PRINT
|
|
610 PRINT "O.K. HOPE YOU HAD FUN!"
|
|
999 END
|