--- title: "Sticks" type: "article" slug: "sticks" url: "http://localhost/article/sticks/" markdown_url: "http://localhost/article/sticks.md" published_at: "2022-10-07T12:25:00+00:00" modified_at: "2024-06-11T13:57:58+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" category: - name: "The Plotter" slug: "the-plotter" taxonomy: "category" url: "http://localhost/category/periodicals/the-plotter/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Imre Auersbacher" slug: "imre-auersbacher" taxonomy: "indiv" url: "http://localhost/indiv/imre-auersbacher/" publication_r: id: 21216 title: "The Plotter" type: "periodical" url: "http://localhost/periodical/the-plotter/" authors: "Imre Auersbacher" volume: "9" issue: "7" issues_articles: - id: 39489 title: "The Plotter v9 n7" type: "issue" url: "http://localhost/issue/the-plotter-v9-n7/" pages: "6-7" pubdate: "July 1991" archive_link: false article_media: - id: 55048 title: "Game of Sticks (NIM)" type: "computer_media" url: "http://localhost/computer_media/game-of-sticks-nim/" --- # Sticks ## Source Code: Game of Sticks (NIM) ``` 2 REM Game of Sticks (NIM) 4 REM \* 1985 I. Auersbacher 6 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 999 SAVE "sticks" LINE 6 ```