Sleuth
- Type
- Game
- Category
- Two-player memory (Concentration) game
- Author
- Heath Lawrence
- Published in
- Antic, June 1988 (Vol. 7, No. 2), Bonus Game
- Year
- 1988
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, any memory size, Atari BASIC, one or two joysticks
- Tags
- antic, bonus-game, memory-game, concentration, two-player, joystick, graphics-1, redefined-characters, family, atari-basic
- Related
- Recall, Citadel, Vectron, Recall, 1040 Terminator, Caverns of the Minotaur
About the program
Sleuth is a memory game modelled on the TV show Concentration. Under an 18×19 grid of blank blocks (342 squares) are little pictures: faces, houses, telephones, musical notes, helicopters, spacemen and more. Players take turns uncovering two squares. A matching pair stays on the board and scores a point, and the first player to 10 points wins. Antic had recently printed two other Concentration games, BASIC Concentration for the ST and Recall for the 8-bit, but both of those asked you to solve a word puzzle. Sleuth doesn't, which made it a good family game for children who can't read yet.
It was Heath Lawrence's fourth Antic game, after Cliffhanger, Vectron and Citadel. Antic said all four came from an unpublished book of Atari games he had written.
Typing it in
The listing has 58 lines and only a few special characters. In this notation, {inv}…{/inv} means type with the Atari (inverse) key on. In GRAPHICS 1, the inverse U and V that appear throughout show up as the blank block and the cursor, because of the redefined character set. The shape DATA in lines 460–520 is 26 characters of 8 bytes each, and line 430 reads exactly that many, so a missing number will throw everything after it out of line.
How to play
RUN, and type 1 or 2 to say whether you have one joystick to share or one each. The program then copies the character set and redefines it ("PLEASE WAIT…"), which takes a little while in BASIC. Then it draws the grid, with a little man for each player at the bottom.
On your turn, move the flashing cursor with the joystick and press the button to reveal a picture. Do it again for a second square. A match turns both pictures green and makes your man jump for joy. If they don't match, a 10-second countdown gives everyone a chance to memorise them before they're covered again. The arrow at the bottom shows whose turn it is. When someone reaches 10, a star appears under the winner, and START begins a new game.
Lawrence's tip: use landmarks. Uncover squares in corners or next to pairs that are already matched, so that they're easier to remember. And watch the countdown closely, because your opponent will.
How it works
The board is a GRAPHICS 1 text screen, and every picture is a redefined character. Line 430 copies the ROM font into RAM below a lowered RAMTOP, one PEEK and POKE at a time, which is why it's slow. It then overwrites characters 33 onwards with 26 new shapes from DATA. These are the 16 icons, the cursor and grid blocks, the reveal animation (characters 215–218, played in turn when a square opens) and the four frames of the jumping man. The hidden picture for each square is kept in the array POS(X,Y), and line 370 fills it with a random choice of 16 icons. Pairs are therefore random too, which keeps every game different. A match is simply V1=V2. When a pair is found, line 310 adds 32 to both character codes, which in GRAPHICS 1 changes the colour register and turns the pictures green.
Variations to try
- The article suggests changing the delay in line 170 (
FOR D=1 TO 20) for a faster or slower cursor, and the one in line 60 for a longer or shorter countdown. - Make a quicker game for small children by playing to 5 instead of 10 (lines 90–130).
Listing
5 REM SLEUTH
6 REM BY HEATH LAWRENCE
7 REM (c)1988, ANTIC PUBLISHING
10 GOSUB 405
20 GOSUB 350
30 REM MAIN ROUTINE
40 GOSUB 160:V1=Z:X1=CX:Y1=CY:GOSUB 160:V2=Z:X2=CX:Y2=CY:CX=10:CY=10:LOCATE 10,10,Z:IF Z<97 THEN Z=213
50 IF V1=V2 THEN SC=1:GOTO 80
60 C=95:FOR Q=10 TO 0 STEP -1:C=C+5:SOUND 1,C,10,8:POSITION 9,0:? #6;Q;"{inv}V{/inv}":FOR D=1 TO 100:NEXT D:NEXT Q
70 POSITION X1,Y1:? #6;"{inv}U{/inv}":POSITION X2,Y2:? #6;"{inv}U{/inv}":SOUND 1,0,0,0
80 IF PL=1 AND SC=1 THEN SC1=SC1+1:POSITION 6,21:? #6;SC1;:JX=1:GOSUB 310
90 IF PL=1 AND SC1<>10 THEN PL=2:I=1:F=13:STE=1:GOSUB 230:GOTO 120
100 IF PL=2 AND SC=1 THEN SC2=SC2+1:POSITION 18,21:? #6;SC2:JX=13:GOSUB 310
110 IF PL=2 AND SC2<>10 THEN PL=1:I=13:F=1:STE=-1:GOSUB 230
120 SC=0:IF SC1=10 THEN JX=1:GOTO 260
130 IF SC2=10 THEN JX=13:GOTO 260
140 GOTO 40
150 REM MOVE CURSOR
160 S=STICK((PL-1)*STCK):POKE 77,0:IF STRIG((PL-1)*STCK)=0 AND Z=213 THEN GOSUB 280:RETURN
170 IF S=15 THEN POSITION CX,CY:? #6;"{inv}V{/inv}":FOR D=1 TO 20:NEXT D:POSITION CX,CY:? #6;CHR$(Z):GOTO 160
180 POSITION CX,CY:? #6;CHR$(Z)
190 AX=1*(S=5 OR S=6 OR S=7)-1*(S=9 OR S=10 OR S=11):AY=1*(S=9 OR S=13 OR S=5)-1*(S=10 OR S=14 OR S=6)
200 CX=CX+AX:CY=CY+AY:CX=CX+17*(CX<1)-18*(CX>18):CY=CY+18*(CY<1)-19*(CY>19):LOCATE CX,CY,Z:POSITION CX,CY
210 ? #6;"{inv}V{/inv}":SOUND 1,X+Y,10,8:SOUND 1,0,0,0:GOTO 160
220 REM INDICATE PLAYER TURN
230 FOR L=I TO F STEP STE:POSITION L,22:? #6;"^":FOR D=1 TO 30:NEXT D:POSITION L,22:? #6;" "
240 SOUND 1,L+90,10,8:NEXT L:POSITION F,22:? #6;"^":SOUND 1,0,0,0:RETURN
250 REM GAME OVER
260 POSITION JX,22:? #6;"*":JUMPS=1:GOSUB 310:ON PEEK(53279)<>6 GOTO 260:GOTO 20
270 REM REVEAL SHAPE
280 FOR A=215 TO 218:POSITION CX,CY:? #6;CHR$(A):SOUND 1,(A-200)*5,10,8:FOR D=1 TO 75:NEXT D:NEXT A:SOUND 1,0,0,0
290 POSITION CX,CY:? #6;CHR$(POS(CX,CY)):Z=POS(CX,CY):RETURN
300 REM JUMP ANIMATION
310 POSITION X1,Y1:? #6;CHR$(V1+32):POSITION X2,Y2:? #6;CHR$(V2+32):LOCATE 10,10,Z:FOR NJ=1 TO JUMPS
320 FOR P=200 TO 10 STEP -8:SH=225*(P>175)+226*(P<176 AND P>120)+227*(P<121 AND P>65)+228*(P<66):SOUND 1,P,10,8
330 POSITION JX,21:? #6;CHR$(SH):NEXT P:POSITION JX,21:? #6;"{inv}a{/inv}":NEXT NJ:SOUND 1,0,0,0:RETURN
340 REM INITIALIZE/PLAYFIELD
350 GRAPHICS 17:POKE 756,ST/256:POKE 712,35:POKE 710,0:SC1=0:SC2=0:JUMPS=4:PL=1:CX=10:CY=10:Z=213
360 FOR X=0 TO 19:POSITION X,0:? #6;"{inv}V{/inv}":POSITION X,20:? #6;"{inv}V{/inv}":NEXT X:FOR Y=0 TO 20:POSITION 0,Y:? #6;"{inv}V{/inv}"
370 POSITION 19,Y:? #6;"{inv}V{/inv}":NEXT Y:FOR Y=1 TO 19:FOR X=1 TO 18:POS(X,Y)=INT(RND(0)*16)+69:POSITION X,Y:? #6;"{inv}U{/inv}"
380 SOUND 1,(X+Y)*3,10,8:NEXT X:NEXT Y:SOUND 1,0,0,0:POSITION 1,21:? #6;"{inv}a #1{/inv} 0":POSITION 13,21:? #6;"{inv}a #2{/inv} 0"
390 POSITION 1,22:? #6;"^":RETURN
400 REM REDEFINE
405 GRAPHICS 0:POKE 710,96:POKE 712,96:POSITION 15,2:? "SLEUTH"
406 POSITION 12,10:? "1 Joystick":? :? ,"2 Joysticks"
408 POSITION 17,15:INPUT STCK:STCK=STCK-1:IF NOT (STCK=0 OR STCK=1) THEN 405
410 DIM POS(30,30):POKE 106,PEEK(740)-5:GRAPHICS 17:POKE 712,96:POSITION 6,7:? #6;"SLEUTH":POSITION 8,10
420 ? #6;"{inv}by:{/inv}":POSITION 3,13:? #6;"{inv}HEATH LAWRENCE{/inv}":POSITION 3,17:? #6;"PLEASE WAIT...":ST=(PEEK(106)+1)*256
430 FOR X=0 TO 1023:POKE ST+X,PEEK(57344+X):NEXT X:Z=264:FOR SHAPE=1 TO 26:FOR X=0 TO 7:READ BYTE
440 POKE ST+Z+X,BYTE:NEXT X:Z=Z+8:NEXT SHAPE:RETURN
450 REM SHAPE DATA
460 DATA 24,24,60,90,153,36,36,102,25,26,60,88,152,37,34,96,153,90,60,24,24,165,66,0,24,24,60,90,153,231,0,0,60
470 DATA 126,90,126,126,90,102,60,24,24,72,62,9,56,78,193,108,16,126,239,223,223,110,60,254,16,48,121,222,120
480 DATA 132,0,24,60,126,66,255,219,90,195,60,90,153,255,255,153,90,60,56,68,130,255,129,181,177,255,60,102,102
490 DATA 14,24,0,24,24,36,24,165,90,90,165,24,36,60,36,36,36,60,60,165,126,132,72,48,255,133,135,133,255,0,8,254
500 DATA 28,62,255,90,60,0,126,255,165,60,90,129,255,24,60,36,126,165,189,36,102,60,102,195,255,60,60,60,126,15
510 DATA 14,8,8,8,104,240,96,170,1,128,1,128,1,128,85,255,255,255,255,255,255,255,255,255,255,255,231,231,255
520 DATA 255,255,255,255,231,195,195,231,255,255,255,195,129,129,129,129,195,255,195,129,0,0,0,0,129,255
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: SLEUTH.BAS.
Credits
- Program listing: Sleuth — program listing (Antic, June 1988 (Vol. 7, No. 2), Bonus Game) — Heath Lawrence
- Picture: The 18×19 grid of hidden pictures. The arrow under player 2's man shows whose turn it is. — Heath Lawrence (program); screenshot by the site
- Antic, June 1988 - Vol. 7 No. 2 — article: game by Heath Lawrence — Heath Lawrence, 1988
- Antic Software Archive — June 1988 - Vol. 7 No. 2 disk: SLEUTH.BAS — AtariMagazines.com (Kevin Savetz), 1988
