A 10-line TurboBASIC XL program for the Atari 8-bit computer
Written for 2014 NOMAM programming competition

Bill Kendrick, February 19, 2014

An entry for the NOMAM 2014 10-line TurboBASIC XL game competition.


This is a tiny version of the game Mahjong solitaire (like Shanghai), played on a board 3-levels deep and 7x7 in size.

Use a joystick in port 1 to play. Using the flashing cursor, select pairs of matching tiles. Tiles on the lowest level are darkest, tiles on the topmost level are highest. You may only select a tile if it is "free" — there is no other tile adjacent to it on either the right and/or left sides.

If you attempt select a tile that isn't free, or you've selected one tile, and then try to select a non-matching tile, a buzzer will sound. If you select two matching tiles, they'll both disappear. Any tiles underneath (on a lower level than) the removed tiles will be revealed.


...coming soon...

It was developed for the NOMAM 2014 competition.

Line-by-line Breakdown of the Source Code


10 GRAPHICS 2:CH=PEEK(106)-16:POKE 756,CH:CH=CH*256:POKE 559,0:FOR I=0 TO 7:POKE CH+I,85+(85*(I MOD 2)):NEXT I:POKE 711,15:FOR I=8 TO 240 20 POKE CH+I,127-PEEK(57600+I):NEXT I:SC=DPEEK(88):L=83:DIM B(196),C(L),SZ(2):FOR I=0 TO L-1:C(I)=INT(I/4)+1:NEXT I:X1=-1 30 FOR Z=0 TO 2:FOR Y=Z TO 6-Z:FOR X=Z TO 6-Z:R=RAND(L):C=C(R):C(R)=C(L-1):L=L-1:B(Z*49+Y*7+X)=C:NEXT X:NEXT Y:NEXT Z 40 FOR Z=0 TO 2:FOR Y=Z TO 6-Z:FOR X=Z TO 6-Z:POKE SC+Y*20+X+42,B(Z*49+Y*7+X)+Z*64:NEXT X:NEXT Y:POKE 708+Z,(Z+1)*69:NEXT Z:POKE 559,34

Main loop

50 SZ=SC+(Y+2)*20+(X+2):CC=PEEK(SZ):POKE SZ,192:S=STICK(0):IF S=7:X=(X+1) MOD 7:ENDIF :IF S=11:X=(X+6) MOD 7:ENDIF 60 IF S=13:Y=(Y+1) MOD 7:ENDIF :IF S=14:Y=(Y+6) MOD 7:ENDIF :PAUSE 2:POKE SZ,CC:PAUSE 2:C(P)=CC:C2=CC&192:Z=C2/64 70 IF STRIG(0)=0 AND CC:IF P=1 AND SZ=SZ(0):POKE SZ,C(0):P=0:ELSE :IF P=1:POKE SZ(0),C(0):ENDIF 80 Q=PEEK(SZ-1):R=PEEK(SZ+1):IF (Q=0 OR Q&192<C2 OR R=0 OR R&192<C2) AND (P=0 OR CC&63=PEEK(SZ(0))&63):SZ(P)=SZ:P=P+1 90 IF P=2:FOR I=0 TO 1:IF C(I)&192=0:POKE SZ(I),0:ELSE :Z=(C(I)&192)/64-1:POKE SZ(I),B(Z*49+Y*7+X)+Z*64:ENDIF 100 NEXT I:P=0:ENDIF :ELSE :? "{bell}":ENDIF :PAUSE 4:IF P=1:POKE SZ(0),(C(0)&63)+192:ENDIF :ENDIF :ENDIF :GOTO 50


Bill Kendrick, 2014,, New Breed Software
Other games I wrote for NOMAM 2014