Compucolor.org – Virtual Media

Listing of file='HIQ.BAS;02' on disk='vmedia/ncc_5-sector.ccvf'

1 PLOT 12:PRINT TAB( 25);" H-I-Q "
4 DIM B(70),T(9,9)
5 PRINT "HERE IS THE BOARD:":PRINT
6 PRINT "          !    !    !"
7 PRINT "          13   14   15"
8 PRINT "          !    !    !"
9 PRINT "          22   23   24"
10 PRINT "!    !    !    !    !    !    !"
11 PRINT "29   30   31   32   33   34   35"
12 PRINT "!    !    !    !    !    !    !"
13 PRINT "38   39   40   41   42   43   44"
14 PRINT "!    !    !    !    !    !    !"
15 PRINT "47   48   49   50   51   52   53"
16 PRINT "          !    !    !"
17 PRINT "          58   59   60"
18 PRINT "          !    !    !"
19 PRINT "          67   68   69":PRINT
20 PRINT "TO SAVE TYPING TIME, A COMPRESSED VERSION OF THE GAME BOARD"
21 PRINT "WILL BE USED DURING PLAY.  REFER TO THE ABOVE ONE FOR PEG"
24 PRINT "NUMBERS.  OK, LET'S BEGIN."
25 BL$= "                            "
28 REM  *** SET UP BOARD
29 FOR R= 1TO 9
30 FOR C= 1TO 9
31 IF (R- 4)* (R- 5)* (R- 6)= 0THEN 40
32 IF (C- 4)* (C- 5)* (C- 6)= 0THEN 40
35 T(R,C)= - 5
36 GOTO 50
40 IF (R- 1)* (C- 1)* (R- 9)= 0THEN 35
42 T(R,C)= 5
50 NEXT C
60 NEXT R
65 T(5,5)= 0:GOSUB 500
70 REM  *** INPUT MOVE AND CHECK ON LEGALITY
75 FOR W= 1TO 33
77 READ M
79 DATA 13,14,15,22,23,24,29,30,31,32,33,34,35,38,39,40,41
81 DATA 42,43,44,47,48,49,50,51,52,53,58,59,60,67,68,69
83 B(M)= - 7:NEXT W
86 B(41)= - 3
100 GOSUB 3000:PLOT 3,35,25:INPUT "MOVE WHICH PIECE ? ";Z$:REM 
105 Z= VAL (Z$):IF Z= 0THEN 120
110 IF B(Z)= - 7THEN 140
120 PLOT 3,35,28:PRINT "ILLEGAL MOVE, TRY AGAIN...":FOR ZZ= 1TO 2000:NEXT :GOTO 100
140 PLOT 3,35,26:INPUT "TO WHERE ? ";P$:REM 
142 PRINT ""
145 P= VAL (P$):IF P= 0THEN 120
150 IF B(P)= 0THEN 120
153 IF B(P)= - 7THEN 120
156 IF Z= PTHEN 100
160 IF ((Z+ P)/ 2)= INT ((Z+ P)/ 2)THEN 180
170 GOTO 120
180 IF (ABS (Z- P)- 2)* (ABS (Z- P)- 18)< > 0THEN 120
190 GOSUB 1000
200 GOSUB 500
210 GOSUB 1500
220 GOTO 100
500 REM  *** ? BOARD
510 FOR X= 1TO 9
520 FOR Y= 1TO 9
525 IF (X- 1)* (X- 9)* (Y- 1)* (Y- 9)= 0THEN 550
530 IF (X- 4)* (X- 5)* (X- 6)= 0THEN 570
540 IF (Y- 4)* (Y- 5)* (Y- 6)= 0THEN 570
550 REM
560 GOTO 610
570 IF T(X,Y)< > 5THEN 600
580 PRINT TAB( Y* 2);"!";
590 GOTO 610
600 PRINT TAB( Y* 2);"O";
610 REM
615 NEXT Y
620 PRINT
630 NEXT X
640 RETURN
1000 REM  *** UPDATE BOARD
1002 PLOT 3,16,21
1005 C= 1:FOR X= 1TO 9
1020 FOR Y= 1TO 9
1030 IF C< > ZTHEN 1220
1040 IF C+ 2< > PTHEN 1080
1045 IF T(X,Y+ 1)= OTHEN 120
1050 T(X,Y+ 2)= 5
1060 T(X,Y+ 1)= 0:B(C+ 1)= - 3
1070 GOTO 1200
1080 IF C+ 18< > PTHEN 1130
1085 IF T(X+ 1,Y)= 0THEN 120
1090 T(X+ 2,Y)= 5:T(X+ 1,Y)= 0:B(C+ 9)= - 3
1120 GOTO 1200
1130 IF C- 2< > PTHEN 1170
1135 IF T(X,Y- 1)= 0THEN 120
1140 T(X,Y- 2)= 5:T(X,Y- 1)= 0:B(C- 1)= - 3
1160 GOTO 1200
1170 IF C- 18< > PTHEN 1220
1175 IF T(X- 1,Y)= 0THEN 120
1180 T(X- 2,Y)= 5:T(X- 1,Y)= 0:B(C- 9)= - 3
1200 B(Z)= - 3:B(P)= - 7
1210 T(X,Y)= 0:GOTO 1240
1220 C= C+ 1
1225 NEXT Y
1230 NEXT X
1240 RETURN
1500 REM *** CHECK IF GAME IS OVER
1505 F= 0
1510 FOR R= 2TO 8
1520 FOR C= 2TO 8
1530 IF T(R,C)< > 5THEN 1580
1535 F= F+ 1
1540 FOR A= R- 1TO R+ 1
1545 T= 0
1550 FOR B= C- 1TO C+ 1
1560 T= T+ T(A,B)
1561 NEXT B
1564 IF T< > 10THEN 1567
1565 IF T(A,C)< > 0THEN 1630
1567 NEXT A
1568 FOR X= C- 1TO C+ 1
1569 T= 0
1570 FOR Y= R- 1TO R+ 1
1571 T= T+ T(Y,X)
1572 NEXT Y
1573 IF T< > 10THEN 1575
1574 IF T(R,X)< > 0THEN 1630
1575 NEXT X
1580 NEXT C
1590 NEXT R
1600 REM  *** GAME IS OVER
1605 PRINT "THE GAME IS OVER."
1610 PRINT "YOU HAD";F;"PIECES REMAINING."
1611 IF F< > 1THEN 1615
1612 PRINT "BRAVO!  YOU MADE A PERFECT SCORE!"
1613 PRINT "TAKE A PICTURE AS A RECORD OF YOUR ACCOMPLISHMENT!"
1615 PRINT :INPUT "PLAY AGAIN(YES OR NO)";A$
1617 IF A$= "N0"THEN 2000
1618 RESTORE :GOTO 28
1620 STO P
1630 RETURN
2000 PRINT :PRINT "SO LONG FOR NOW.":PRINT
2010 LOAD "MENU"
3000 REM  BLANK OUT MESSAGE AREA
3010 FOR N= 0TO 5
3020 PLOT 3,35,25+ N:PRINT BL$
3030 NEXT :RETURN