Elimination (1K)

Developer(s): Michael Williams
Date: 1983
Type: Program
Platform(s): TS 2068
Tags: Dice

Elimination is a number game in the “shut the box” style. The digits 1 to 9 are shown across the top of the screen and the computer rolls a total. You type numbers, one at a time, that add up to the roll, and each one is struck out of the row. When the roll is used up a new one is made; if you can’t make the total from what is left, typing 0 starts a new game. Clear all nine digits and the program prints “WINNER”. An instruction screen comes first.

The REM credits it as “ELIMINATE, © Sync, Jan/Feb 1983, by Michael B. Williams”. Williams’s “Elimination in 1K” appeared in the SYNC letters column (January/February 1983) as a string-based rewrite, small enough for an unexpanded ZX81, of A. Dan Klyver’s “Elimination” from SYNC 2:5. This TS2068 version, found on SNUG-ISTUG Public Domain Library disk #12, adds the instruction screen with coloured text; who made the 2068 port is not recorded.

Program Analysis

Program Structure

  • Line 20 calls the instruction screen at 260–290, which waits for a key release and then a key press.
  • Lines 40–60 set up the number row a$ and roll a total r, rerolling a zero.
  • Lines 70–210 take input: each number is range-checked, checked against the row, added to the running total t and blanked out of b$.
  • Lines 220–240 carry the reduced row forward and test for an empty row (“WINNER”).

Notable Techniques

  • The board is a single string, " 1 2 3 4 5 6 7 8 9"; digit n sits at position n+n, so no array is needed — the trick that let the original fit in 1K.
  • Assigning "" to a single character slice (LET b$(n+n)="") pads it to a space, which is how a number is struck out.
  • IF NOT n THEN RUN restarts the game on a 0 entry.
  • A bad entry or an overshoot (t>r) quietly returns to line 70, which restores the row to its state before the roll.

Potential Issues

  • Line 50 computes the roll as INT (RND*6)+INT (RND*6)*2, which gives totals from 1 to 15 with uneven odds rather than the 2–12 of two dice. It appears to be a typo for +2.

This copy comes from an Oliger (JLO SAFE) disk. It was converted for tape (no changes to the program were needed) and tested in ZEsarUX.

Related Articles

Elimination is a traditional dice game which provides a worthwhile vehicle for teaching young children (and others) simple strategy, an understanding of odds, and the mental manipulation of numbers.
Help Wanted; New Product Problems; Elimination; DEF and PAUSE

Related Content

Image Gallery

Source Code

   10 REM >>  ELIMINATE  <<                                      * Sync, Jan/Feb 1983                      by Michael B. Williams 
   20 GO SUB 260
   30 RANDOMIZE 
   40 LET a$=" 1 2 3 4 5 6 7 8 9"
   50 LET r=INT (RND*6)+INT (RND*6)*2
   60 IF r=0 THEN GO TO 50
   70 LET t=0
   80 LET b$=a$
   90 CLS 
  100 PRINT "Numbers to Eliminate"
  110 PRINT AT 4,0;"ROLL ";r
  120 PRINT AT 2,0;b$;" "
  130 INPUT n
  140 IF NOT n THEN RUN 
  150 IF ABS (n-5)>4 THEN GO TO 70
  160 IF b$(n+n)<>STR$ n OR NOT CODE b$(n+n)-32 THEN GO TO 70
  170 LET t=t+n
  180 IF t>r THEN GO TO 70
  190 LET b$(n+n)=""
  200 PRINT AT 4,11;"TOTAL ";t
  210 IF t<r THEN GO TO 120
  220 LET a$=b$
  230 IF a$<>"                  " THEN GO TO 50
  240 PRINT AT 0,0;"WINNER***************"
  250 STOP 
  260 CLS : PRINT "ELIMINATE"''' INK 1;"  The object of the game is to  eliminate all 9 numbers."''"  The computer will roll up a   random number, and you choose   one or more numbers remaining   of those shown that totals to   the roll.  If you can't do this,type '0' and ENTER and the game will restart."'''' INK 2;"PRESS A KEY TO CONTINUE..."
  270 IF INKEY$<>"" THEN GO TO 270
  280 IF INKEY$="" THEN GO TO 280
  290 CLS : RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.