10 REM *** MAGIAPOTAGIA 1977 ***
20 CALL -936
40 DIM L$(14): DIM M$(14): DIM R$(14): DIM B$(42)
50 B$="1A2A3A4A5A6A7A8A9A1B2B3B4B5B6B7B8B9BJJXXZZ"
70 VTAB 18: TAB 5: PRINT "I'LL TRY TO GUESS  WHICH CARD IS"
80 VTAB 19: TAB 6: PRINT "THE ONE YOU HAVE CHOSEN - JUST"
90 VTAB 20: TAB 5: PRINT "TELL ME,  WHICH COLUMN IS IT IN?"
100 REM *** MAIN LOOP ***
110 FOR T=1 TO 3
200 REM *** DISTRIBUTE CARDS ***
210 FOR Z=1 TO 7
220 L$(2*Z-1)=B$(6*Z-5,6*Z-4)
230 M$(2*Z-1)=B$(6*Z-3,6*Z-2)
240 R$(2*Z-1)=B$(6*Z-1,6*Z)
250 NEXT Z
300 REM *** PRINT CARDS ***
310 FOR Y=1 TO 3:W=2+8*Y
320 VTAB 1: TAB W: PRINT "+----+"
330 FOR Z=1 TO 7: VTAB 2*Z: TAB W
340 IF Y=1 THEN PRINT "! ";L$(2*Z-1,2*Z);" !"
350 IF Y=2 THEN PRINT "! ";M$(2*Z-1,2*Z);" !"
360 IF Y=3 THEN PRINT "! ";R$(2*Z-1,2*Z);" !"
370 VTAB 1+2*Z: TAB W: PRINT "+----+": NEXT Z
380 VTAB 15: TAB W: PRINT "!    !": VTAB 16: TAB W: PRINT "+----+": NEXT Y
390 VTAB 22: TAB 25: PRINT " ": VTAB 22: TAB 16: INPUT "(L/M/R?) ",Q$
400 REM *** CHECK INPUT ***
410 IF Q$="L" THEN GOSUB 470
420 IF Q$="M" THEN GOSUB 480
430 IF Q$="R" THEN GOSUB 490
440 IF T=3 THEN GOTO 460
450 FOR Z=1 TO 16: VTAB Z: TAB 10: PRINT "                      ": NEXT Z
460 NEXT T: GOTO 500
470 B$(1)=M$:B$(15)=L$:B$(29)=R$: RETURN
480 B$(1)=L$:B$(15)=M$:B$(29)=R$: RETURN
490 B$(1)=M$:B$(15)=R$:B$(29)=L$: RETURN
500 REM *** THE REVEAL ***
510 FOR Z=18 TO 22: VTAB Z: TAB 5: PRINT "                                ": NEXT Z
520 VTAB 18: TAB 4: PRINT "YOUR CARD IS ";B$(21,22);", AND THAT'S MAGIC!"
530 VTAB 20: TAB 8: INPUT "INPUT 'P' TO PLAY AGAIN: ",Q$ 
550 IF Q$="P" THEN CALL -936
560 IF Q$="P" THEN GOTO 50
590 END
