10 REM WARI.ECB 15 REM ... WARI Kilobaud MICROCOMPUTING; Nov. 79: page 118 20 DIM A(6),P(2),V(12),Z(6),P$(8),C$(8),Z$(18) 30 PRINT "&K&J" 40 PRINT TAB(17);"::::::::::::::::::::" 50 PRINT TAB(16);":::: ::::" 60 PRINT TAB(15);":::: W A R I ::::" 70 PRINT TAB(16);":::: ::::" 80 PRINT TAB(17);"::::::::::::::::::::" 90 FOR X=1 TO 3: PRINT : NEXT X 100 PRINT "<*> Do you want a description of the game? ---=>"; 110 INPUT (1,0)I$ 120 IF LEN(I$)=0 THEN LET I$="N" 130 PRINT 140 IF I$="N" THEN 1000 ELSE PRINT "&K&J" 150 PRINT " WARI is reportedly the most popular game in" 160 PRINT "WEST AFRICA. It's origins go back to early EGYPT" 170 PRINT "which this version most closely resembles. Don't" 180 PRINT "be fooled by the fact that it may take all of 5" 190 PRINT "minutes to learn. The actual course of a game is" 200 PRINT "unpredictable and often baffling. Totals will" 210 PRINT "shift suddenly and a 35-5 score can become a" 220 PRINT "20-20 score in a single move. And the number" 230 PRINT "of possible strategies are unlimited." 240 PRINT 250 PRINT "<*> Type in any letter when ready for more ---=>"; 260 INPUT (1,0)I$ 270 PRINT "&K" 280 PRINT " As played by tribesmen in Africa, WARI" 290 PRINT "requires only two players, 12 cups, and 72" 300 PRINT "playing pieces. (Usually stones or pebbles)" 310 PRINT 320 PRINT " The cups are arranged in two rows of six" 330 PRINT "between the two players. Each player controls" 340 PRINT "the row of six nearest him and places 6 pebbles" 350 PRINT "in each of his 6 cups. (36 pieces each)" 360 PRINT 370 PRINT " Play begins as the first player removes all" 380 PRINT "the pieces from any cup in his row and, moving" 390 PRINT "in a counterclockwise direction, distributes" 400 PRINT "the pieces (ONE PER CUP) among all 12 cups." 410 PRINT 420 PRINT "<*> Type in any letter when ready for more ---=>"; 430 INPUT (1,0)I$ 440 PRINT "&K&J" 450 PRINT "The second player then does likewise with" 460 PRINT "one of his cups." 470 PRINT 480 PRINT " During any turn, if the last pebble falls in" 490 PRINT "a cup containing only one or two other pebbles," 500 PRINT "all the pebbles in that cup are discarded and" 510 PRINT "not counted in either player's total." 520 PRINT 530 PRINT " The game ends when a player has no pieces left" 540 PRINT "to move. Then the other playrer must make one" 550 PRINT "last move that will keep all the pieces" 560 PRINT "in his cup." 570 PRINT 1000 REM ....Initialize.... 1010 FOR X=1 TO 12: LET V(X)=6: NEXT X 1020 DATA 0,36,36,0,0,1," " 1030 READ F,P(1),P(2),Q,Q1,R,Z$ 1040 PRINT "<*> Do you wish to play against the computor? ---=>"; 1050 INPUT (1,0)I$ 1060 IF LEN(I$)=0 THEN LET I$="N" 1070 PRINT 1080 IF I$="Y" THEN LET S=1 ELSE LET S=0 1090 DATA 20,18,16,14,12,18 1100 FOR X=1 TO 6: READ A(X): NEXT X 1110 PRINT "<*> 1st players name? ---=>"; 1120 INPUT (8,0)P$ 1130 PRINT 1140 IF LEN(P$)>8 THEN LET L(1)=8 ELSE LET L(1)=LEN(P$) 1150 FOR H=1 TO 8: LET P$=P$+"-": NEXT H 1160 IF S=1 THEN LET C$="COMPUTOR" 1170 LET P$=P$(1,8) 1180 LET L(2)=8 1190 IF S=1 THEN 1250 1200 PRINT "<*> 2st players name? ---=>"; 1210 INPUT (8,0)C$ 1220 IF LEN(C$)>8 THEN LET L(2)=8 ELSE LET L(2)=LEN(C$) 1230 FOR H=1 TO 8: LET C$=C$+".": NEXT H 1240 LET C$=C$(1,8): PRINT 1250 PRINT TAB(15);"(1) ";P$ 1260 PRINT TAB(15);"(2) ";C$ 1270 PRINT 1280 PRINT "<*> Who moves first? (1 or 2) ---=>"; 1290 INPUT (1,0)X 1300 PRINT 1310 IF X=1 OR X=2 THEN PRINT ELSE 1250 1320 LET Y=ABS(X-3) 1330 LET I$=" " 2000 REM ....Display Routine.... 2010 PRINT "&K" 2020 PRINT "*----------------";P$;"---------------* "; 2030 PRINT P$(1,L(1));" Total=";P(1) 2040 IF X=2 THEN PRINT TAB(43);Z$;I$ ELSE PRINT 2050 PRINT " (A) (B) (C) (D) (E) (F) " 2060 PRINT " ";V(12);TAB(9);V(11);TAB(16);V(10);TAB(23);V(9); 2070 PRINT TAB(30);V(8);TAB(37);V(7);TAB(45);"ROUND:";R 2080 PRINT 2090 PRINT " :::::::::::( W A R I )::::::::::: TOTAL dicards:";Q 2100 PRINT TAB(45);"No. Discarded:";Q1 2110 PRINT " (G) (H) (I) (J) (K) (L)" 2120 PRINT " ";V(1);TAB(9);V(2);TAB(16);V(3);TAB(23);V(4); 2130 PRINT TAB(30);V(5);TAB(37);V(6) 2140 IF X=1 THEN PRINT TAB(43);Z$;I$ ELSE PRINT 2150 PRINT "*................";C$;"...............* "; 2160 PRINT C$(1,L(2));" Total=";P(2) 3000 REM ....Game Control.... 3010 IF F=1 THEN 3180 3020 IF X=2 THEN 3130 3030 IF X=1 THEN PRINT "<*> ";P$; ELSE PRINT "(+) ";C$; 3040 PRINT " Which of your cups do you want to empty? ---=>"; 3050 INPUT (1,0)U$ 3060 IF LEN(U$)=0 THEN 3000 3070 LET M=ASC(U$) 3080 IF X=2 THEN 3100 3090 IF M<65 OR M>70 THEN 3120 ELSE 3300 3100 IF M<71 OR M>76 THEN 3120 ELSE 3300 3110 PRINT U$;" Can't be emptied by you!" 3120 GOTO 3030 3130 IF S=0 THEN 3030 ELSE PRINT 3140 PRINT C$(1,L(2));" EMPTIES: "; 3150 GOTO 5000 3160 PRINT I$ 3170 GOTO 4000 3180 IF Y=1 THEN PRINT P$; ELSE PRINT C$; 3190 PRINT " HAS no more MOVES!" 3200 IF X=1 THEN PRINT P$; ELSE PRINT C$; 3210 PRINT " DECLARED WINNER!" 3220 PRINT TAB(15);"Type 'RUN' to play again." 3230 GOTO 6000 3300 IF X=2 THEN LET Z$=C$(1,L(2)) ELSE LET Z$=P$(1,L(1)) 3310 LET Z$=Z$+" emptied: " 3320 LET I$=CHR(M) 4000 REM ....TEST and Score.... 4010 FOR H=1 TO 2: LET P(H)=0: NEXT H 4020 LET Q1=0 4030 LET M=M-64 4040 IF M>6 THEN LET M=M-6 ELSE LET M=ABS(M-13) 4050 IF V(M)=0 THEN PRINT U$;" is already empty." 4060 IF V(M)=0 THEN 3040 ELSE LET A=V(M) 4070 LET B=M+1 4080 LET V(M)=0 4090 IF B=13 THEN LET B=1 4100 LET V(B)=V(B)+1 4110 LET A=A-1 4120 IF A=0 THEN 4150 4130 LET B=B+1 4140 GOTO 4090 4150 IF V(B)=2 OR V(B)=3 THEN LET Q1=V(B) ELSE 4180 4160 LET Q=Q+V(B) 4170 LET V(B)=0 4180 FOR H=7 TO 12: LET P(1)=P(1)+V(H): NEXT H 4190 FOR H=1 TO 6: LET P(2)=P(2)+V(H): NEXT H 4200 IF P(Y)=0 THEN LET F=1 ELSE 4220 4210 GOTO 4250 4220 LET X=ABS(X-3) 4230 LET Y=ABS(X-3) 4240 LET R=R+.5 4250 GOTO 2000 5000 REM ....COMPUTOR MOVE.... 5010 LET G=1 5100 REM ...Level 1 Strategy... 5110 FOR H=1 TO 6: LET Z(H)=A(H): NEXT H 5120 FOR H=1 TO 6 5130 IF V(H)=0 THEN LET Z(H)=0 5140 NEXT H 5200 REM ...Level 2 Strategy... 5210 FOR H=1 TO 6 5220 IF V(H)=0 THEN 5360 ELSE LET A=V(H) 5230 LET B=H+1 5240 LET C=20 5250 LET E=1 5260 IF B=13 THEN LET B=1 5270 LET A=A-1 5280 IF A=0 THEN 5330 ELSE LET B=B+1 5290 LET E=E+1 5300 IF E=13 THEN LET D=D-1 5310 IF E=13 THEN LET E=1 5320 GOTO 5260 5330 IF V(B)>D OR V(B)=0 THEN 5350 5340 IF B>6 THEN LET C=30 ELSE LET C=10 5350 LET Z(H)=Z(H)+C 5360 NEXT H 5400 REM ...Level 3 Strategy... 5410 FOR H=1 TO 6 5420 LET A=0 5430 IF V(H)=0 THEN 5530 5440 IF V(H)<7-H THEN 5520 ELSE LET A=V(H)-(5-H) 5450 IF A<7 THEN 5520 ELSE LET B=1 5460 LET A=0 5470 LET B=B-13 5480 LET A=A+6 5490 IF B<1 THEN 5520 5500 IF B>6 THEN 5470 5510 LET A=A+B 5520 LET Z(H)=Z(H)+(50-A) 5530 NEXT H 5600 REM ...Level 4 Strategy... 5610 LET A=10 5620 IF P(1)>6 OR P(2)>6 THEN 5700 5630 IF P(2)