There was comment at the last meeting that the “STICKS” game in a recent THE PLOTTER newsletter was stacked against the player as the computer always won. Yes, I figured it that way too. Anyway, here is a different program that the player can sometimes win (at least in the NOVICE catagory). This 2068 program provides for a variable computer input for the number of sticks. Also, the maximum number of allowable moves is variable. Contrary to the other game, the player is always first.
This program by Imre Auersbacher was printed in the September 1986 issue of CTM Magazine, which is no longer being published.
NOTE: the problem of printing graphic symbols requires these additions to lines 10 and 32.
line 10, the 14 spaces between the second set of quotes, insert the graphic 3 as G3.
line 32, between the first set of quotes, start with CSG4, then 30 of G3, then G7.
line 32, between the second set of quotes, start with CSG1, then 30 of CSG3, then CSG2.
2 REM Game of Sticks (NIM)
4 REM 1985 I. Auerabacher
8 BORDER 6: PAPER 5: CLS
10 PRINT PAPER 7;AT 2,8;"Game of Sticks"; PAPER 5;AT 3,8;" "; PAPER 7;AT 5,8;"Level of Play ";AT 7,11;"1- Novice";AT 8,11;"2- Expert": GO SUB 400
12 INPUT "Enter Option: ";d
14 LET d=INT d: IF (d<1)+(d>2) THEN BEEP 1,-20: GO TO 12
20 PRINT PAPER 3;AT 6+d,8;">>"
25 DIM z$(30): LET y=INT (RND*21)+10: LET mm=INT (RND*6)+3
30 PAUSE 100: CLS : BEEP .1,20
32 PRINT PAPER 7;AT 3,0;" ";AT 4,0;" ";AT 4,31;" ";AT 5,0;" "
35 PRINT PAPER 7;AT 1,2;"Sticks: ";y;" ";AT 1,17;"Max move: ";mm;" ": GO SUB 300: GO SUB 400
40 PRINT PAPER 7;AT 9,5;"Player move ": INPUT pm: IF (pm<=0)+(pm>mm)+(pm>y) THEN BEEP 0.5,-16: BEEP 0.7,-20: GO TO 40
50 PRINT PAPER 7;AT 9,18;pm: LET y=y-pm: IF y>0 THEN GO TO 85
70 PRINT PAPER 7;AT 4,1;" ";AT 1,10;"0"; FLASH 1;AT 9,5;" You lose, sucker!! ": STOP
85 GO SUB 300: PRINT PAPER 7;AT 1,2;"Sticks: ";y;" ": PAUSE 100: IF d<>2 THEN GO TO 110
95 LET z=(y-1)/(mm+1): LET cm=(mm+1)*(z-INT z)+.01: GO TO 135
110 LET cm=INT (RND*mm)+1
115 IF y<>1 THEN GO TO 130
120 LET cm=1: GO TO 140
130 IF y<=mm THEN LET cm=y-1
135 IF INT cm=0 THEN LET cm=1
140 LET cm=INT cm: PRINT PAPER 7;AT 9,5;"Computer takes: ";cm: LET y=y-cm: PAUSE 100
155 IF y<>0 THEN GO TO 170
160 PRINT PAPER 7;AT 4,1;" ";AT 1,10;"0"; FLASH 1;AT 9,5;".....you win.....": STOP
170 GO SUB 300: PRINT PAPER 7;AT 1,2;"Sticks: ";y;" ": PAUSE 100: GO TO 40
300 DIM z$(30): FOR z=1 TO y: LET z$(z)="I": NEXT z: PRINT PAPER 7; INK 0;AT 4,1;z$: RETURN
400 INK 0: PLOT 0,72: DRAW 255,0: DRAW 0,103: DRAW -255,0: DRAW 0,-103: INK 0: RETURN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.