Plays Yahtzee for two players on a scorecard drawn with PLOT and DRAW, with the five dice shown down the right edge of the screen using a UDG pip. Each player gets up to three rolls a turn: R rolls, 1–5 hold dice before the next roll, 0 releases them and T scores early. To score, SPACE moves a flashing cursor down the card and ENTER registers the box. Thirteen rounds fill the thirteen boxes, with a 35-point bonus for 63 or more in the upper section, and each extra ABASHI (five of a kind) after the first is worth 100 and can be used as a joker. The one deliberate rule change is in the straights: a Low Straight is 1–5 for 30 points and a High Straight is 2–6 for 40, in place of Yahtzee’s small and large straights. At the end the program names the winner and offers to play again, quit, or save itself to tape.
The title screen reads “The Ancient Game of ABASHI”, “By Herb Bowers, Sr.”, dated 10/10/88, “from ABA Software”. The first B of the name is a backward B printed with UDG b; the REM in line 1 marks the program as public domain and says the backward B is ABA’s trademark. The introduction credits Milton Bradley’s YAHTZEE and suggests buying the boxed game for its printed rules, then gives a screen on the straights rule and one of key instructions.
Program Analysis
Structure
- Lines 1–70: setup and six
DEF FNfunctions used by the dice sort. - Lines 100–290: the “Third Roll!” prompt and a routine that groups the five dice by value into
x$,y$,z$andw$. - Lines 500–690: title screen, then the scorecard, its labels read from
DATAand its boxes drawn withPLOT/DRAW. - Lines 700–950: the game loop (13 rounds × 2 players × 3 rolls) and the scoring cursor.
- Lines 1000–1360: score update, screen update and the game-over menu.
- Lines 2000–2520: one scoring routine per lower-section box.
- Lines 3000–3070: dice roll animation; 5000–5210: UDGs and dice faces; 6000–6210: instructions.
Scoring
The cursor row is held in l (1–6 for the upper boxes, 9–15 for the lower). Line 1030 dispatches with GO SUB l*100+1000: there is no line 1900, so box 9 (3 of a Kind) lands on line 2000, which also serves box 10 by testing l. A zero score is stored as -1 so the box counts as used, and line 1240 adds 1 back when printing. A straight is recognised when the sort finds five different values (w$(1)<>w$(2)) and the dice total 15 (1–5) or 20 (2–6). Scores are kept in a(19,2), one column per player.
Notable Techniques
DEF FN x()=(s(f)=VAL x$(1))and its companions make the dice sort a short chain of function calls.- The variable
ois read as 0 from theDATAin line 690 and used in place of the literal 0 throughout. - Line 820 finds where the cursor was left with
ATTR (16,8)=176(flashing yellow paper). - The game-over menu is one computed jump:
GO TO 1340-((INKEY$="P")*740)+((INKEY$="S")*10)+((INKEY$="Q")*20). - A random “please wait” message is picked from
DATAwhile the score is worked out. POKE 23658,8turns on caps lock so the single-letter keys read as capitals.ON ERR GO TO 9990puts the scoring cursor back on line 15 after an error.
Potential Issues
- A tie is announced as a win for player #1, because line 1310 sets
win=1+(a(19,2)>a(19,1)). - The 35-point upper bonus is added to Total Lower (
a(17,p), line 1080), not to the Total Upper row. The Grand Total is still right.
This copy comes from Bob Swoger’s Larken games disk. For tape, the RANDOMIZE USR 100 calls and the LOGICALL load were removed from the save and load lines at 9997–9998, and the program now autostarts at line 1. It was tested in ZEsarUX.
Source Code
1 BORDER 6: PAPER 7: INK 0: CLS ::: REM AbBASHI (AHH-BAH-SHE) from Her Bowers --Public Domain--for backward "B" as is AbBA" trademark, use GRAPHICS B
10 CLS : LET quit=0: GO TO 500
20 DEF FN x()=(s(f)=VAL x$(1))
30 DEF FN y()=(s(f)=VAL y$(1))
40 DEF FN z()=(s(f)=VAL z$(1))
50 DEF FN x$()=x$+STR$ s(f)
60 DEF FN y$()=y$+STR$ s(f)
70 DEF FN z$()=z$+STR$ s(f)
100:: REM Various Holds::
110 INPUT INKEY$: PRINT #0;AT 0,0; FLASH 1;"Third Roll!"
120 PRINT #0;AT 1,0;"Press [ENTER] to Continue": BEEP .05,-10
130 IF INKEY$<>CHR$ 13 THEN GO TO 130
190 RETURN
200:: REM Dice Sort Routine::
210 LET x$=STR$ s(1): LET y$="": LET z$="": LET w$="": LET w=1
220 FOR f=2 TO 5
230 IF FN x() THEN LET x$=FN x$(): GO TO 290
240 IF NOT LEN y$ THEN LET y$=FN y$(): GO TO 290
250 IF FN y() THEN LET y$=FN y$(): GO TO 290
260 IF NOT LEN z$ THEN LET z$=FN z$(): GO TO 290
270 IF FN z() THEN LET z$=FN z$(): GO TO 290
280 LET w$(w)=STR$ s(f): LET w=w+1
290 NEXT f: RETURN
500:: REM Start Program::
510 GO SUB 5000: PRINT ''g$'
520 PRINT AT 4,6;"The Ancient Game of"''TAB 12;"*AbBASHI*"
530 PRINT 'g$
540 PRINT 'TAB 8;"By Herb Bowers, Sr.";TAB 11;"10/10/88"
550 PRINT 'g$
560 PRINT 'TAB 8;"from AbBA Software"
570 PRINT 'g$: IF quit THEN RETURN
580 PAUSE 300: GO SUB 6000
600:: REM Print Screen::
610 POKE 23658,8
620 RANDOMIZE 0: CLS : PRINT TAB 7;"AbBASHI";TAB 15;"#1";TAB 21;"#2": RESTORE : FOR f=1 TO 19: IF f=8 OR f=17 THEN PRINT
630 READ r$: PRINT r$: NEXT f
640 READ o,x,y,z: PLOT o,o: DRAW x,o: DRAW o,y: DRAW -x,o: DRAW o,-y
650 PLOT o,z: DRAW x,o: PLOT o,31: DRAW x,o: PLOT o,105: DRAW x,o: PLOT o,111: DRAW x,o
660 PLOT 104,o: DRAW o,y: PLOT 150,o: DRAW o,y
670 FOR f=7 TO 151 STEP 32: PLOT 213,f: DRAW 31,o: DRAW o,z: DRAW -31,o: DRAW o,-z: NEXT f
680 DATA "Aces","Twos","Threes","Fours","Fives","Sixes","Total Upper","Bonus>=63","3 of a Kind","4 of a Kind","Full House","Low Straight","High Straight","AbBASHI","Chance","AbBASHI Bonus","Total Lower","Total Upper","Grand Total"
690 DATA 0,196,167,25
700:: REM Play the Game::
710 DIM w$(2): DIM y(2): DIM j(2): DIM a(19,2): DIM s(5): DIM h(5): FOR t=1 TO 13: FOR u=o TO 1: LET p=u+1
720 FOR r=1 TO 3: LET lock=o: PRINT AT o,o;"Rnd ";t; FLASH NOT u;AT o,15;"#1"; FLASH u;AT o,21;"#2"; FLASH 0;TAB 26;"Roll ";r: BEEP .09,o
730 INPUT INKEY$: PRINT #0;"Hold(1-5):" AND r<>1;"R=Roll";":T=Tally:0=Reset" AND r<>1
740 LET i$=INKEY$: IF i$="" THEN GO TO 740
750 IF r<>1 AND i$>"0" AND i$<"6" THEN FOR f=3 TO VAL i$*4 STEP 4: LET H(VAL i$)=1: LET lock=1: NEXT f: PRINT FLASH 1;AT f-4,31;VAL i$: BEEP .005,20
755:: REM ^Lock Dice^::
760 IF i$="R" THEN GO SUB 3000: NEXT r: GO SUB 100: GO TO 800
765:: REM ^To Roll Dice^::
770 IF r<>1 AND i$="T" AND NOT lock THEN GO TO 800
775:: REM ^To Tally Routine^::
780 IF i$="0" THEN LET lock=o: GO SUB 3060: REM Release Lock:
790 GO TO 740
800:: REM Tally Routine::
810 LET ok=o
820 LET l=o+((ATTR (16,8)=176)*15)
830 LET li=1: IF NOT l THEN INPUT INKEY$: PRINT #0;AT o,o;"[SPACE BAR] to Move Cursor"'"[ENTER] to Register Score": BEEP .5,o
840 LET i$=INKEY$
845 ON ERR GO TO 9990
850 IF ok THEN IF i$=CHR$ 13 AND NOT a(l,p) THEN GO SUB 1000: NEXT u: NEXT t: GO TO 1300
860 IF i$<>CHR$ 32 THEN GO TO 840
870:: REM Move Tally Cursor::
880 LET l=l+1: IF l=7 THEN LET l=9
890 IF l=16 THEN LET l=1
900 IF li=1 THEN PRINT OVER 1;AT 16,o;" "
910 IF li>1 THEN PRINT ; OVER 1;AT li-(1+((li=10)*3)),o;" "
920 PRINT PAPER 6; OVER 1; FLASH 1;AT li,o;" "
930 LET li=li+1: IF li=7 THEN LET li=10
940 BEEP .05,20+1+l: IF li=17 THEN GO TO 820
950 LET ok=1: GO TO 840
1000:: REM Read dice::
1010 RESTORE 1040: LET r=INT (RND*6)+1: FOR f=1 TO r: READ r$: NEXT f: INPUT INKEY$: PRINT #0;AT 1,0; FLASH 1;r$: BEEP .05,20
1020 LET td=o: FOR f=1 TO 5: LET td=td+s(f): NEXT f: IF y(p) AND td/5=((s(1)+s(2))/2) THEN GO SUB 2400
1030 LET a(8,p)=((a(7,p)>62)*35): IF l>6 THEN GO SUB l*100+1000: GO SUB 1100: INPUT INKEY$: RETURN
1040 DATA "STANDBY PLEASE","HANG IN THERE","DOIN' MY 'RITHMETIC","COMPUTING","I'm a 2068 & ""I have the power""","PLEASE WAIT, ""GOOD LOOKING'"""
1050:: REM Upper Score Update::
1060 LET n=o: FOR f=1 TO 5
1070 IF s(f)=l THEN LET n=n+l
1080 NEXT f: LET a(l,p)=n-(n=o): LET a(7,p)=a(7,p)+n*(n=ABS n): IF NOT a(8,p) AND a(7,p)>62 THEN LET a(8,p)=35: LET a(17,p)=a(17,p)+35
1090 LET a(18,p)=a(18,p)+n*(n>0): GO TO 1130
1100:: REM Lower Score Update::
1110 LET a(l,p)=n-(n=o)
1120 LET a(17,p)=a(17,p)+(n*(n=ABS n))
1130 LET a(19,p)=a(17,p)+a(18,p)
1140 LET j(p)=o
1200:: REM Update Screen::
1210 FOR f=1 TO 19: PRINT OVER 1;AT f,o;" "
1220 LET li=f+(f>7)+(f>16)
1230 LET cl=15+(u*6)
1240 IF a(f,p) THEN PRINT AT li,cl+(((a(f,p))<100)+((a(f,p))<10));a(f,p)+((a(f,p))=-1)
1250 IF li=7 THEN LET li=9
1260 IF f=17 THEN LET li=19
1290 NEXT f: PLOT o,o: DRAW x,o: PLOT o,y: DRAW x,o: RETURN
1300:: REM Game Over:: With Menu Options
1310 LET win=1+(a(19,2)>a(19,1))
1320 INPUT INKEY$: PRINT #0;AT o,o; FLASH 1;"GAME OVER! #";win;" is the winner!!!"; FLASH 0'"(Q)uit (P)lay (S)ave to Tape"
1330 POKE 23658,8: FOR f=1 TO 10: BEEP .04,20+f: NEXT f
1340 GO TO 1340-((INKEY$="P")*740)+((INKEY$="S")*10)+((INKEY$="Q")*20)
1350 INPUT INKEY$: SAVE "abbashi" LINE 10: GO TO 1320
1360 LET quit=1: GO SUB 500: GO TO 9999
2000:: REM 3 or 4 of a Kind:: Scores Total Specks
2010 GO SUB 200: LET n=o
2020 IF LEN x$>=3 OR LEN y$>=3 OR LEN z$>=3 OR j(p) THEN IF l=9 THEN LET n=td
2030 IF LEN x$>=4 OR LEN y$>=4 OR LEN z$>=4 OR j(p) THEN IF l=10 THEN LET n=td
2040 RETURN
2100:: REM Full House:: Scores 25
2110 GO SUB 200: LET n=o
2120 IF (LEN x$=3 AND LEN y$=2) OR (LEN x$=2 AND LEN y$=3) OR (j(p)) THEN LET n=25
2130 RETURN
2200:: REM Low Straight,1-5:: Scores 30
2210 GO SUB 200: LET n=o
2220 IF (LEN y$=1 AND LEN x$=1 AND LEN z$=1 AND (w$(1)<>w$(2) AND td=15) OR j(p)) THEN LET n=30
2230 RETURN
2300:: REM High Straight:: Scores 40
2310 GO SUB 200: LET n=o
2320 IF (LEN y$=1 AND LEN x$=1 AND LEN z$=1 AND (w$(1)<>w$(2) AND td=20) OR j(p)) THEN LET n=40
2330 RETURN
2400:: REM AbBASHI Scores 50:: + 100 for ea. add'l
2410 GO SUB 200: LET n=o
2420 IF LEN x$<>5 THEN RETURN
2430 IF a(14,p) THEN GO TO 2450
2440 LET n=50: LET y(p)=1: RETURN
2450 LET j(p)=a(VAL x$(1),p)
2460 LET a(16,p)=a(16,p)+100
2470 LET a(17,p)=a(17,p)+100
2480 RETURN
2500:: REM Chance :: Scores Total Specks
2510 LET n=td
2520 RETURN
2999 STOP
3000:: REM Roll Dice Routine:: Hold Locked Dice
3010 LET d=1: FOR f=1 TO 17 STEP 4: IF h(d) THEN LET d=d+1: NEXT f
3015 IF f>17 THEN GO TO 3060
3020 FOR n=1 TO 5: LET die=INT (RND*6+1)
3030 FOR c=1 TO 3
3040 PRINT AT f+c,27;d$(die,c): BEEP .005,20: LET s(d)=die
3050 NEXT c: NEXT n: BEEP .05,f: LET d=d+1: NEXT f
3060 LET l=1: FOR f=3 TO 22 STEP 4: PRINT AT f,31;l: LET l=l+1: NEXT f
3070 DIM h(5): RETURN
4999 STOP
5000:: REM Setup Dice/Graphics::The dice specks are GRAPHICS "S"
5010 RESTORE 5000: FOR f=1 TO 6: READ b,s
5020 POKE USR "b"+f,b
5030 POKE USR "s"+f,s: NEXT f
5040 DATA 62,0,66,60,62,60,66,60,66,60,62,0
5050 DIM d$(6,3,3)
5060 LET d$(1,2)=" s"
5070 LET d$(2,1)="s"
5080 LET d$(2,3)=" s"
5090 LET d$(3,1)="s"
5100 LET d$(3,2)=" s"
5110 LET d$(3,3)=" s"
5120 LET d$(4,1)="s s"
5130 LET d$(4,3)="s s"
5140 LET d$(5,1)="s s"
5150 LET d$(5,2)=" s"
5160 LET d$(5,3)="s s"
5170 LET d$(6,1)="s s"
5180 LET d$(6,2)="s s"
5190 LET d$(6,3)="s s"
5200 LET g$="********************************"
5210 CLS : RETURN
6000:: REM Introduction::
6010 CLS : PRINT "AbBASHI replicates the game of YAHTZEE as published by Milton Bradley Company. AbBASHI trans-lated means ""A*b*B*A Soft Hangs In"" (there)."
6020 PRINT '"The rules of the game are quite simple. If you will purchase thecopyrighted game, of YAHTZEE youmay obtain printed rules which are used in this demonstration to illustrate the conversion of a boxed game to your TS 2068."
6030 PRINT '"During play, instructions are given at the very bottom of the screen to let you know what to do at each step. Use [SPACE BAR]to move "; PAPER 6; FLASH 1;"scoring cursor"; FLASH 0; PAPER 7;" on screenthen press [ENTER] to inform the2068 that you have made choice."
6050 GO SUB 120
6060 CLS : PRINT TAB 2;"DEVIATION FROM YAHTZEE RULES"
6070 PRINT g$
6080 PRINT '"The major deviation from the official rules is in the treat- ment of ""Straights""."
6090 PRINT '"In YAHTZEE you have LARGE and SMALL straights. The SMALL one is any four consecutive numbers plus another number. The LARGE is any five consecutive numbers and the total point value of thedice is scored."
6100 PRINT '"In AbBASHI there are HIGH & LOW straights. The LOW straight is consecutive numbers 1 thru 5 andHIGH is 2 thru 6. LOW scores 30 and HIGH scores 40."
6110 PRINT g$
6120 GO SUB 120: CLS
6130 PRINT TAB 5;"SPECIAL INSTRUCTIONS"'g$
6140 PRINT '"TO HOLD A DIE: Press 1 to 5."
6150 PRINT '"TO ROLL DICE; Press ""R""."
6160 PRINT '"TO TALLY (score): Press ""T""."
6170 PRINT '"TO RESET:If you have held a die unintentionally, press 0 and re-enter."
6180 PRINT '"After 3 rolls you MUST select a line."
6190 PRINT '"If you have scored an AbBASHI (5dice the same) each additional AbBASHI scores 100 & AbBASHI maybe used as a JOKER if matching line in upper screen is filled."
6200 PRINT #0;AT 0,0;g$
6210 GO SUB 120: RETURN
9990 ON ERR RESET : LET L=15: GO TO 850
9996 STOP
9997 CLEAR : SAVE "ABASHI.B1" LINE 1
9998 CLEARNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


