Card Trick

Date: November 1983
Type: Program
Platform(s): TS 1000

Appears on

Cassette to accompany the November 1983 issue of Synchro-Sette.

Source Code

  10 LET A$="A D2 D3 D4 D5 D6 D7 D8 D9 D10DJ DQ DK DA H2 H3 H4 H5 H6 H7 H8 H9 H10HJ HQ HK HA C2 C3 C4 C5 C6 C7 C8 C9 C10CJ CQ CK CA S2 S3 S4 S5 S6 S7 S8 S9 S10SJ SQ SK S"
  20 LET B$=A$
  30 DIM C$(21,3)
  40 DIM D$(21,3)
  50 DIM E$(21,3)
  80 LET A=0
  90 LET H$="010203040506070809101112131415161718192021"
 100 CLS 
 105 PRINT AT 4,0;1;AT 10,0;2;AT 16,0;3
 110 FOR X=2 TO 14 STEP 6
 120 FOR Y=3 TO 27 STEP 4
 130 GOSUB 1000
 140 NEXT Y
 150 NEXT X
 160 GOSUB 2000
 165 PRINT AT 0,8;"SHUFFLING"
 180 LET D$(1)=C$(1)
 181 LET D$(2)=C$(8)
 182 LET D$(3)=C$(15)
 183 LET D$(4)=C$(2)
 184 LET D$(5)=C$(9)
 185 LET D$(6)=C$(16)
 186 LET D$(7)=C$(3)
 187 LET D$(8)=C$(10)
 188 LET D$(9)=C$(17)
 189 LET D$(10)=C$(4)
 190 LET D$(11)=C$(11)
 191 LET D$(12)=C$(18)
 192 LET D$(13)=C$(5)
 193 LET D$(14)=C$(12)
 194 LET D$(15)=C$(19)
 195 LET D$(16)=C$(6)
 197 LET D$(17)=C$(13)
 198 LET D$(18)=C$(20)
 199 LET D$(19)=C$(7)
 200 LET D$(20)=C$(14)
 201 LET D$(21)=C$(21)
 210 LET A=0
 220 FOR N=1 TO 21
 230 IF N<G*7-6 OR N>G*7 THEN LET C$(N)="   "
 240 NEXT N
 250 GOSUB 5000
 410 PRINT AT 0,8;"SHUFFLING"
 430 FOR X=2 TO 14 STEP 6
 440 FOR Y=3 TO 27 STEP 4
 450 GOSUB 3000
 460 NEXT Y
 470 NEXT X
 480 PRINT AT 0,8;"         "
 490 GOSUB 2000
 500 LET E$(1)=D$(1)
 501 LET E$(2)=D$(8)
 502 LET E$(3)=D$(15)
 503 LET E$(4)=D$(2)
 504 LET E$(5)=D$(9)
 505 LET E$(6)=D$(16)
 506 LET E$(7)=D$(3)
 507 LET E$(8)=D$(10)
 508 LET E$(9)=D$(17)
 509 LET E$(10)=D$(4)
 510 LET E$(11)=D$(11)
 511 LET E$(12)=D$(18)
 512 LET E$(13)=D$(5)
 513 LET E$(14)=D$(12)
 514 LET E$(15)=D$(19)
 515 LET E$(16)=D$(6)
 517 LET E$(17)=D$(13)
 518 LET E$(18)=D$(20)
 519 LET E$(19)=D$(7)
 520 LET E$(20)=D$(14)
 521 LET E$(21)=D$(21)
 525 LET A=0
 530 FOR N=1 TO 21
 535 IF N<G*7-6 OR N>G*7 THEN LET D$(N)="   "
 540 NEXT N
 541 LET B=1
 542 FOR N=1 TO 21
 544 IF D$(N)<>"   " THEN GOTO 550
 546 NEXT N
 548 GOTO 560
 550 LET D$(B)=D$(N)
 552 LET B=B+1
 554 NEXT N
 556 FOR N=B+1 TO 21
 557 LET D$(N)="   "
 558 NEXT N
 560 FOR N=1 TO 7
 565 LET C=0
 570 FOR I=1 TO 7
 580 IF C$(N)=D$(I) THEN LET C=1
 590 NEXT I
 600 IF C=0 THEN LET C$(N)="   "
 610 NEXT N
 615 GOSUB 5000
 620 PRINT AT 0,8;"SHUFFLING"
 630 FOR X=2 TO 14 STEP 6
 640 FOR Y=3 TO 27 STEP 4
 650 GOSUB 4000
 660 NEXT Y
 670 NEXT X
 680 PRINT AT 0,8;"         "
 690 GOSUB 2000
 700 LET A=0
 710 FOR N=1 TO 21
 715 IF N<G*7-6 OR N>G*7 THEN LET E$(N)="   "
 720 NEXT N
 740 LET C=1
 750 FOR I=1 TO 21
 760 IF E$(I)<>"   " THEN GOTO 790
 770 NEXT I
 780 GOTO 820
 790 LET E$(C)=E$(I)
 800 LET C=C+1
 810 NEXT I
 820 FOR N=1 TO 3
 830 FOR I=1 TO 7
 840 IF C$(N)=E$(I) THEN GOTO 900
 850 NEXT I
 860 NEXT N
 900 CLS 
 910 PRINT AT 1,0;"YOUR CARD IS"
 920 LET G$=C$(N)
 921 IF G$(1)="A" THEN LET O$="ACE"
 922 IF G$(1)="2" THEN LET O$="TWO"
 923 IF G$(1)="3" THEN LET O$="THREE"
 924 IF G$(1)="4" THEN LET O$="FOUR"
 925 IF G$(1)="5" THEN LET O$="FIVE"
 926 IF G$(1)="6" THEN LET O$="SIX"
 927 IF G$(1)="7" THEN LET O$="SEVEN"
 928 IF G$(1)="8" THEN LET O$="EIGHT"
 929 IF G$(1)="9" THEN LET O$="NINE"
 930 IF G$( TO 2)="10" THEN LET O$="TEN"
 931 IF G$(1)="J" THEN LET O$="JACK"
 932 IF G$(1)="Q" THEN LET O$="QUEEN"
 933 IF G$(1)="K" THEN LET O$="KING"
 934 IF G$(3)="H" THEN LET P$="HEARTS"
 935 IF G$(3)="D" THEN LET P$="DIAMONDS"
 936 IF G$(3)="S" THEN LET P$="SPADES"
 937 IF G$(3)="C" THEN LET P$="CLUBS"
 940 PRINT "THE ";O$;" OF ";P$
 950 PRINT AT 10,10;"\:'\''\''\: ";AT 11,10;"\:   \: ";AT 12,10;"\:   \: ";AT 13,10;"\:   \: ";AT 14,10;"\:.\..\..\: "
 955 PRINT AT 11,11;G$( TO 2)
 960 PRINT AT 13,12;G$(3)
 970 PAUSE 40000
 980 CLS 
 990 RUN 
1000 LET A=A+1
1020 PRINT AT X,Y;"\:'\''\''\: ";AT X+1,Y;"\:   \: ";AT X+2,Y;"\:   \: ";AT X+3,Y;"\:   \: ";AT X+4,Y;"\:.\..\..\: "
1030 LET Z=INT (52*RND)+1
1050 IF B$(Z*3-2 TO Z*3)="   " THEN GOTO 1030
1070 LET C$(A)=B$(Z*3-2 TO Z*3)
1090 LET B$(Z*3-2 TO Z*3)="   "
1100 PRINT AT X+1,Y+1;C$(A, TO 2)
1110 PRINT AT X+3,Y+2;C$(A,3)
1500 RETURN 
2000 PRINT AT 21,0;" WHICH ROW? ";AT 21,0;"% %W%H%I%C%H% %R%O%W%?% "
2010 LET G$=INKEY$
2020 IF CODE G$<29 OR CODE G$>31 THEN GOTO 2000
2030 LET G=VAL G$
2040 PRINT AT 21,0;"            "
2050 RETURN 
3000 LET A=A+1
3040 PRINT AT X+1,Y+1;D$(A, TO 2)
3060 PRINT AT X+3,Y+2;D$(A,3)
3100 RETURN 
4000 LET A=A+1
4040 PRINT AT X+1,Y+1;E$(A, TO 2)
4060 PRINT AT X+3,Y+2;E$(A,3)
4100 RETURN 
5000 LET B=1
5010 FOR N=1 TO 21
5020 IF C$(N)<>"   " THEN GOTO 5100
5030 NEXT N
5040 GOTO 5130
5100 LET C$(B)=C$(N)
5110 LET B=B+1
5120 NEXT N
5130 FOR N=B+1 TO 21
5140 LET C$(N)="   "
5150 NEXT N
5160 RETURN 
9998 SAVE "CARDTRIC%K"
9999 RUN 

People

No people associated with this content.

Scroll to Top