MARBLES

Developer(s): Jim Rodlin
Date: 1988
Type: Program
Platform(s): ZX81, TS 1000
Tags: Game

A pinball-like marble game for the TS1000 or ZX81. Marbles roll along the top of the screen and drop through a triangle of pins into a row of score slots (9, 3, 1, *, 5, 0, 1, 3, 7; the * slot costs 5 points). Enter the number of players (0 to watch the computer play itself) and their names; each player presses a key to launch each of five marbles a turn, and the computer (“T/S 1000”) plays its own marbles. After five turns the program names the winner (*ME* if the computer won); with no human players it shows the high score and plays again.

Like the author’s MINES, it reads the display file: line 1000 PEEKs the square under the marble to find the pins and, at the bottom, the score slot (its character code minus 28). It needs more than 2K: it was tested on 4K and 16K and stops with report 4 on 2K.

The listing was printed in columns about 30 characters wide, and a space that fell at a row break was lost: line 185 is built and listed as PRINT AT Y,X;”O”;AT Y,X;” ” (without the space the rolling marble leaves a row of Os and the marble count at the top is lost), and the spaces in line 55 (“@ @ @ … @”) and in THE WINNER WAS: are restored the same way. The printed notes in brackets (five GRAPHIC/SHIFT-7s, @ = GRAPHIC/SPACE, 18, six and eight spaces, the GRAPHIC/S in the SAVE name) are built as the characters they name.

Published in the BCS Sinclair-Timex User Group Newsletter March 1988 (T/S 1000 Corner).

Image Gallery

Source Code

   5 REM MARBLES BY JIM RODLIN
  10 FOR Y=0  TO 7
  15 LET HS=0
  16 LET W$=""
  20 RAND 0
  25 LET X=Y
  30 FOR X=15-X TO 15+X STEP 2
  35 PRINT AT Y*2+1,X;CHR$ 3
  40 NEXT X
  45 NEXT Y
  50 PRINT AT 1,0;"[Five GRAPHIC/SHIFT-7's]"
  55 PRINT AT 20,6;"@ @ @ @ @ @ @ @ @" ["@"=GRAPHIC/SPACE]
  60 PRINT TAB 6;"@9@3@1@*@5@0@1@3@7@"
  65 PRINT AT 2,0;"NUMBER OF PLAYERS?"
  70 INPUT N
  75 LET N=N+1
  80 PRINT AT 2,0;"[18 Spaces]"
  85 DIM P$(N,8)
  90 DIM S(N)
  95 FOR X=1 TO N-1
 100 INPUT P$(X)
 105 LET S(X)=0
 110 PRINT AT X+1,0;P$(X);" ";S(X)
 115 NEXT X
 120 LET P$(N)="T/S 1000"
 125 LET S(N)=0
 130 PRINT AT N+1,0;P$(N);" ";0
 135 FOR T=1 TO 5
 140 PRINT AT N+2,0;"TURN ";T
 145 FOR P=1 TO N
 150 PRINT AT 0,20;P$(P)
 155 PRINT AT 0,0;"OOOOO"
 160 FOR B=4 TO 0 STEP -1
 165 LET Y=0
 170 LET SC=PEEK 16396+256*PEEK 16397
 175 IF NOT P$(P)="T/S 1000" THEN IF INKEY$="" THEN GOTO 175
 180 FOR X=B TO 14
 185 PRINT AT Y,X;"O";AT Y,X;" "
 190 NEXT X
 195 PRINT AT 0,15;"O";AT 0,15;" "
 200 GOSUB 1000
 205 PRINT AT Y,X;" "
 210 IF C=3 THEN LET X=X+1-(2 AND INT (RND*10)<5)
 215 IF C=3 THEN PRINT AT Y,X;"O"
 220 LET Y=Y+1
 225 PRINT AT Y-1,X;" "
 230 PRINT AT Y,X;"O"
 235 IF Y=20 THEN GOTO 245
 240 GOTO 200
 245 GOSUB 1000
 250 LET S(P)=S(P)+(C-28)
 255 PRINT AT P+1,9;S(P);" "
 260 PRINT AT Y,X;" "
 265 NEXT B
 270 NEXT P
 275 PRINT AT N+2,p;"[Six spaces]"
 280 NEXT T
 285 PRINT AT 0,20;"[Eight spaces]"
 290 IF N=1 THEN GOTO 355
 295 FOR X=1 TO N
 300 IF S(X)=HS THEN GOSUB 345
 305 IF S(X)>HS THEN GOSUB 335
 310 NEXT X
 315 PRINT AT 0,16;"THE WINNER WAS:"
 320 IF W$="T/S 1000" THEN LET W$="*ME*"
 325 PRINT AT 1,23-(LEN W$)/2;W$
 330 STOP
 335 LET W$=P$(X)
 336 LET HS=S(X)
 340 RETURN
 345 LET W$="TIE"
 350 RETURN
 355 PRINT AT 1,18;"HIGH SCORE:"
 360 IF S(1)>HS THEN LET HS=S(1)
 365 PRINT AT 1,29;HS
 370 GOTO 120
1000 LET C=PEEK(SC+33*(Y+1)+X+1)
1005 RETURN
2000 SAVE "MARBLE@" ["@" = GRAPHIC/S)
2005 RUN

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