--- title: "Solitaire" id: 71985 type: "computer_media" slug: "solitaire-4" url: "http://localhost/computer_media/solitaire-4/" markdown_url: "http://localhost/computer_media/solitaire-4.md" published_at: "2026-10-20T14:59:25+00:00" modified_at: "2026-10-20T14:59:25+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/4_solitaire_1.png" excerpt: "Golf-style patience: clear seven columns of face-up cards by playing them one rank up or down onto the pile, with king and ace wrapping round." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Card Game" slug: "card-game" taxonomy: "genre" url: "http://localhost/type/card-game/" media_contents: - id: 71988 title: "Misc Programs" type: "computer_media" url: "http://localhost/computer_media/misc-programs/" media_type: "Program" tsrun_member: "Misc Programs (198x)(-)(TS2068)(US)(Cassette)/SideB/4_solitaire.tap" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/10/4_solitaire_1.png" - url: "http://localhost/wp-content/uploads/2026/10/4_solitaire_0.png" media_type_tags: "Card Game" --- # Solitaire A patience game played like Golf. Thirty-five cards are dealt face up in seven columns of five, one card starts the waste pile, and the other sixteen form the stock. Pressing `1`–`7` moves the bottom card of that column onto the pile if it is one rank above or below the pile’s top card, with king and ace counting as adjacent. Pressing `0` turns the next card from the stock. The game is won when every column is cleared, and otherwise it ends when the stock runs out and reports how many cards were left. While the deck is shuffled, the screen shows the heading “VIDEOSPECTRUM, Revista de software, No. 1”. *** ## Program Analysis ### Program Structure 1. **Graphics** (lines 20–100): six UDGs are defined for the heart, diamond, club and spade, a one-character “10”, and a patterned card back. 2. **Shuffle and deal** (lines 120–310): the deck is the string `CHR$ 1` to `CHR$ 52`. Cards are taken at random and dealt into the array `a(6,7)`, where row 1 holds the index of each column’s top card, and the remainder go into the stock array `b()`. 3. **Display** (lines 320–480): the columns are drawn as overlapping cards on a green table, with rank and suit in the corner of each card and a full face on the bottom card. 4. **Play** (lines 500–790): handles the keys, checks ranks, and redraws the column, the pile and the stock count. ### Notable Techniques - Subroutine 800 decodes a card number into suit and rank strings using string `AND` expressions, and sets red ink for hearts and diamonds. - Jacks, queens and kings are shown as UDGs `j`, `q` and `k`. The program never redefines these, so they still hold the letters J, Q and K that the TS2068 puts in the UDG area at power-up. - `BEEP` signals a legal move with a short high tone and an illegal one with a longer, lower tone. ### Potential Issues - The court cards depend on UDGs j, q and k still holding their power-up letters. If an earlier program has redefined them, jacks, queens and kings show the wrong symbols. - When a randomly chosen card has already been dealt, the shuffle takes the next unused card in sequence. This makes some orderings more likely than others. - At the “another game” prompt, any answer other than `y` or `n` falls through to line 730 and turns a stock card. ## Source Code ``` 1 CLS 5 PRINT AT 10,10;" SOLITAIRE " 9 PRINT AT 20,3;"PRESS ANY KEY TO CONTINUE.": PAUSE 0: CLS 20 DATA 0,54,127,127,62,28,8,0 30 DATA 0,0,28,62,127,62,28,8 40 DATA 0,8,28,42,127,42,8,28 50 DATA 0,8,28,62,127,42,8,28 60 DATA 0,70,201,73,73,73,230,0 70 DATA 153,90,60,255,255,60,90,150 80 FOR i=144 TO 149: FOR j=0 TO 7 90 READ a: POKE USR CHR$ i+j,a 100 NEXT j: NEXT i 110 CLS : BORDER 4: PAPER 4: INK 0 120 DIM a(6,7): DIM b(17): LET b(1)=17: LET b$="" 130 LET a$="": FOR i=1 TO 52: LET a$=a$+CHR$ i: NEXT i 140 PAPER 7: BORDER 4: PRINT AT 11,11;"SHUFFLING": INK 2: PRINT AT 1,1;"VIDEOSPECTRUM": PRINT AT 2,1;"Revista de software" 145 PRINT AT 3,1;"______________________________": INK 0: PAPER 4 148 PRINT AT 1,26;"No. 1" 150 FOR i=1 TO 52 160 LET w=INT (RND*52+1) 170 IF CODE a$(w)<>0 THEN GO TO 200 180 LET w=w+1: IF w=53 THEN LET w=1 190 GO TO 170 200 LET b$=b$+CHR$ w 210 LET a$(w)=CHR$ 0 220 NEXT i 230 LET a=0 240 FOR i=1 TO 7 250 FOR j=2 TO 6 260 LET a=a+1 270 LET a(j,i)=CODE b$(a) 280 NEXT j: NEXT i 290 FOR i=1 TO 7: LET a(1,i)=6: NEXT i 300 LET a=a+1: LET b=CODE b$(a) 310 FOR i=2 TO 17: LET a=a+1: LET b(i)=CODE b$(a): NEXT i 320 CLS : PRINT " ";: FOR i=1 TO 7: PRINT STR$ i;" ";: NEXT i: PRINT 330 FOR i=2 TO 5: PRINT 340 FOR j=1 TO 7: LET a=a(i,j): GO SUB 800 350 PRINT " "; PAPER 7;b$;" "; 360 NEXT j 370 PRINT 380 FOR j=1 TO 7: LET a=a(i,j): GO SUB 800 390 PRINT " "; PAPER 7;a$;" "; 400 NEXT j 410 PRINT : FOR j=1 TO 7: PRINT " "; PAPER 7;"___";: NEXT j 420 NEXT i 430 PRINT : FOR j=1 TO 7: LET a=a(6,j): GO SUB 800: PRINT " "; PAPER 7;b$;" ";: NEXT j 440 PRINT : FOR j=1 TO 7: LET a=a(6,j): GO SUB 800: PRINT " "; PAPER 7;a$;" ";: NEXT j 450 PRINT : FOR j=1 TO 7: PRINT " "; PAPER 7;" ";: NEXT j 460 PRINT : FOR j=1 TO 7: LET a=a(6,j): GO SUB 800: PRINT " "; PAPER 7;" ";a$;: NEXT j 470 PRINT : FOR j=1 TO 7: LET a=a(6,j): GO SUB 800: PRINT " "; PAPER 7;b$;" ";: NEXT j 480 PRINT AT 21,1; INK 0;"CARDS LEFT IN PILE: 16"; PAPER 7 490 GO SUB 860 500 GO SUB 880: GO SUB 890 510 LET a$=INKEY$ 520 IF a$<"0" OR a$>"7" THEN GO TO 510 530 LET c=VAL a$: IF NOT c THEN GO TO 730 540 IF a(1,c)=1 THEN BEEP 1,0: GO TO 510 550 LET a=a(a(1,c),c): GO SUB 800: LET d=w 560 LET a=b: GO SUB 800 570 IF d=13 AND w=1 THEN GO TO 600 580 IF d=1 AND w=13 THEN GO TO 600 590 IF ABS (d-w)<>1 THEN BEEP 1,0: GO TO 510 600 BEEP .25,30 610 LET b=a(a(1,c),c): GO SUB 860 620 LET a(1,c)=a(1,c)-1: LET d=(a(1,c)-1)*3+1 630 LET a=a(a(1,c),c): GO SUB 800: LET c=(c-1)*4+1 640 IF d=1 THEN FOR i=2 TO 6: PRINT AT i,c; PAPER 4;" ": NEXT i: GO TO 670 650 PRINT AT d,c;" ";AT d+1,c;" ";a$;AT d+2,c;" ";b$ 660 PAPER 4: PRINT AT d+3,c;" ";AT d+4,c;" ";AT d+5,c;" ": PAPER 7 670 FOR i=1 TO 7: IF a(1,i)<>1 THEN GO TO 510 680 NEXT i: PAPER 4: INK 0: PRINT AT 11,3;"CONGRATULATIONS,YOU WON!" 690 INK 0: PRINT AT 13,3;"DESIRE ANOTHER GAME? (y/n)" 700 INPUT a$ 710 IF a$(1)="y" THEN GO TO 110 715 IF a$(1)="n" THEN GO TO 1000 730 BEEP .25,30: IF b(1)=1 THEN GO TO 770 740 LET b=b(b(1)): GO SUB 860: LET b(1)=b(1)-1 750 GO SUB 880: IF b(1)>1 THEN GO SUB 890 760 PRINT AT 21,22; PAPER 4; INK 0;b(1)-1;" ": GO TO 510 770 LET c=0: FOR i=1 TO 7: LET c=c+a(1,i): NEXT i: LET c=c-7 780 PAPER 4: INK 0: PRINT AT 11,6;"YOU LOST BY ";c;" CARDS" 790 GO TO 690 800 LET w=INT ((a-1)/13) 810 LET a$=("a" AND NOT w)+("b" AND w=1)+("c" AND w=2)+("d" AND w=3) 820 INK 2: IF w>1 THEN INK 0 830 LET w=a-w*13 840 IF w<10 AND w<>1 THEN LET b$=STR$ w: RETURN 850 LET b$=("e" AND w=10)+("j" AND w=11)+("q" AND w=12)+("k" AND w=13)+("A" AND w=1): RETURN 860 LET a=b: GO SUB 800: PRINT AT 5,29; PAPER 4;"___": PRINT AT 6,29;b$;" ";AT 7,29;a$;" "; 870 PRINT AT 8,29;" ";AT 9,29;" ";a$;AT 10,29;" ";b$: RETURN 880 PAPER 4: FOR i=12 TO 16: PRINT AT i,29;" ": NEXT i: PAPER 7: RETURN 890 PAPER 2: INK 7: FOR i=12 TO 16: PRINT AT i,29;"fff": NEXT i: PAPER 7: RETURN 1000 CLS 1140 STOP 9999 SAVE "SOLITAIRE" LINE 1 ```