User Tools

Site Tools


mmbasic_original:checker_bas

CHECKER.BAS

This module is part of the original MMBasic library. It is reproduced here with kind permission of Hugh Buckle and Geoff Graham. Be aware it may reference functionality which has changed or is deprecated in the latest versions of MMBasic.

CHECKER.BAS

1 CLS
2 PRINT TAB(30);"ONE CHECK"
4 PRINT TAB(15);"CREATIVE COMPUTING MODIFIED BY BILL BROWN FOR MAXIMITE"
6 PRINT:PRINT:PRINT
8 DIM A(64),Z(10,10)
10 PRINT "SOLITILE CHECKER PUZZEL"
15 PRINT
20 PRINT "48 CHECKERS ARE PLACED ON THE TWO OUTSIDE SPACES OF A"
25 PRINT "STANDARD CHECKER BOARD.  THE OBJECT IS TO REMOVE AS"
30 PRINT "MANY CHECKERS AS POSSIBLE BY DIAGONAL JUMPS"
35 PRINT "(AS IN STANDARD CHECKERS). "
36 PRINT "ENTER '0' WHEN ASKED TO 'JUMP FROM' TO TERMINATE GAME."
37 PRINT :PRINT
62 PRINT:INPUT "PRESS [ENTER] TO CONTINUE";H$
63 CLS
65 GOSUB 800
77 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
93 NEXT J
96 M=0
98 GOTO 340
100 LOCATE 50,360:PRINT"                                        "
104 LOCATE 50,360:INPUT"JUMP FROM ";F
105 IF F=0 THEN 500
110 LOCATE 150,360:INPUT " TO ";T
112 PRINT
118 REM *********** CHECK IF LEGAL*********
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 LOCATE 50,390:PRINT "ILLEGAL MOVE. TRY AGAIN ...."
235 PAUSE 1000
236 LOCATE 50,390:PRINT "                              "
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 W=1
345 FOR J=1 TO 8
350 FOR I=1 TO 8
360 IF A(W)=1 THEN
370   Z(J,I)=1
375 ELSE 
376   Z(J,I)=0
377 ENDIF
388 W=W+1
389 NEXT I
390 NEXT J
400 FOR J=1 TO 8
410 FOR i= 1 TO 8
411 IF Z(J,I)=0 THEN 417
412 CIRCLE(I*40,J*40),8,2,f
413 GOTO 430
417 CIRCLE(I*40,J*40),8,0,f
430 REM
435 NEXT I
440 NEXT J
470 PRINT
480 GOTO 100
490 REM ************** END GAME ***************
500 S=0
510 FOR I = 1 TO 64
520 S=S+A(I)
530 NEXT I
535 CLS
540 PRINT "YOU MADE ";M;"JUMPS AND HAD ";S;" PIECES"
541 PRINT "REMAINING ON THE BOARD"
542 PRINT
543 PRINT "RATING:   30-37  AVERAGE"
544 PRINT "          38-41  EXPERT"
545 PRINT "          42-46  MASTER"
546 PRINT "          47     GRAND MASTER"
547 PRINT:PRINT
569 INPUT "TRY AGAIN (Y/N) ";A$
570 IF A$= "Y" OR A$ = "y" THEN 63
580 PRINT
590 PRINT "O.K  HOPE YOU HAD FUN!!"
600 GOTO 1999
800 REM
840 FOR x=1 TO 8
850 LOCATE X*40,24:PRINT X
851 LOCATE X*40,64:PRINT X+8
852 LOCATE X*40,104:PRINT X+16
853 LOCATE X*40,144:PRINT X+24
854 LOCATE X*40,184:PRINT X+32
855 LOCATE X*40,224:PRINT X+40
856 LOCATE X*40,264:PRINT X+48
857 LOCATE X*40,304:PRINT X+56
860 NEXT x
900 LINE (20,20)-(340,340),2,B
910 FOR X=60 TO 300 STEP 40
920 LINE (20,X)-(340,X),2
926 LINE (X,20)-(X,340),2
930 NEXT X
940 LOCATE 110,8:PRINT  "ONE CHECK"
1000 RETURN
1999 END
mmbasic_original/checker_bas.txt · Last modified: 2024/01/19 09:39 by 127.0.0.1