--- title: "Pelmanism" id: 72358 type: "computer_media" slug: "pelmanism" url: "http://localhost/computer_media/pelmanism/" markdown_url: "http://localhost/computer_media/pelmanism.md" published_at: "2026-10-23T07:47:14+00:00" modified_at: "2026-10-23T07:47:14+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/pelmanism-2.png" excerpt: "Two-player Concentration with a full 52-card deck laid face down in four rows; turn two cards at a time and score for every matching pair of values." 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/" indiv: - name: "Simon White" slug: "simon-white" taxonomy: "indiv" url: "http://localhost/indiv/simon-white/" genre: - name: "Card Game" slug: "card-game" taxonomy: "genre" url: "http://localhost/type/card-game/" media_type: "Program" programmers: - name: "Simon White" slug: "simon-white" taxonomy: "indiv" url: "http://localhost/indiv/simon-white/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Pelmanism%20%281984%29%28White%2C%20Simon%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "Pelmanism (1984)(White, Simon)(TS2068)(US)(Program)/Pelmanism (1984)(White, Simon)(TS2068)(US)(Program).tap" mediadate: "1984" images: - url: "http://localhost/wp-content/uploads/2026/10/pelmanism-2.png" - url: "http://localhost/wp-content/uploads/2026/10/pelmanism-1.png" media_type_tags: "Card Game" license: false --- # Pelmanism A two-player game of Pelmanism, or Concentration. The program draws 52 card outlines in four rows of thirteen and deals a shuffled deck face down into them. A flashing cursor marks the current card: 5 and 8 move it left and right, wrapping from row to row, 0 turns the card over and q ends the game. Each player turns two cards. If the values match, the pair is crossed out, the player scores a point and goes again; if not, the cards turn back and the other player takes over. When every card is gone, the deck is shown face up and the winner or a draw is announced. The REM reads “ZX COMPUTING, Feb/Mar. 1984 by Simon White”. The program is plain Sinclair BASIC and runs unchanged on the TS2068. ## Program Analysis ### Deck and Layout The board is held in `a$(8,13)`. Rows 1–4 hold the card values (A, 2–9, a UDG for 10, J, Q, K) and rows 5–8 hold the suit symbol of the card in the same place. Lines 140–240 place each value of each suit in a random empty cell, retrying until they find one. A turned card is printed as its value above its suit, with hearts and diamonds in red. Screen positions map onto the array with `(p-3)/5+1` for the row and `q/2` for the column. ### Turns and Scoring The variable `c` counts turns, and `v`, worked out from whether `c` is odd or even, is the player to move. A match adds one to `c` at line 490 and again at line 570, so the same player keeps the turn; a miss adds one only, passing the turn. The current player’s number is printed down the right edge under a vertical “PLAYER”. The game ends when all 52 cells in the value rows are marked `x`. ## Notable Techniques - UDGs a–e are a narrow “10” and the four suit symbols, POKEd from 40 DATA values. The DATA uses `b`, the variable being read, as an item meaning “same as the last value”. - Line 200 builds the court-card letters in one expression with string `AND`: `(CHR$ 74 AND x=11)+(CHR$ 75 AND x=12)+...`. - Lines 730–740 print “PLAYER 1 HAS WON!” whenever the scores differ, then overprint the 1 with a 2 if player 2 is ahead. - The cursor is a pair of flashing blocks printed with `OVER 1` above and below the card. ## Potential Issues - The instructions name 5, 8 and q but not 0, the key that turns a card over. - Unmatched cards are only shown for the length of an empty `FOR` loop (line 450), which gives very little time to memorize them. This program came from an Oliger (JLO SAFE) disk in the SNUG library set. It needed no changes to load and run from tape. It was tested in ZEsarUX on a stock TS2068 through the title and instructions to the dealt board. ## Source Code ``` 10 REM >> PELMANISM << * ZX COMPUTING, Feb/Mar. 1984 by Simon White 20 RESTORE 930: FOR a=0 TO 39: READ b: POKE USR "a"+a,b: NEXT a 30 BORDER 7: PAPER 7: INK 0: CLS 40 GO SUB 800: CLS : LET m=0: LET n=m: LET c=1 50 PRINT "DEALING. PLEASE WAIT" 60 DIM a$(8,13): LET i=0 70 FOR p=1 TO 4: FOR g=1 TO 13: LET a$(p,g)="m": NEXT g: NEXT p 80 FOR p=14 TO 6+13*16 STEP 16 90 FOR d=10 TO 160 STEP 40 100 PLOT p-1,d-4: DRAW 0,34: DRAW 13,0: DRAW 0,-34: DRAW -13,0 110 NEXT d 120 NEXT p 130 PRINT AT 0,0;"SORTING. PLEASE WAIT" 140 FOR d=1 TO 4 150 FOR x=1 TO 13 160 LET s=INT (RND*4)+1 170 LET r=INT (RND*13)+1 180 IF a$(s,r)<>"m" THEN GO TO 160 190 IF x<10 THEN LET a$(s,r)=CHR$ (48+x) 200 IF x>=10 THEN LET a$(s,r)=(CHR$ 74 AND x=11)+(CHR$ 75 AND x=12)+(CHR$ 81 AND x=13)+(CHR$ 144 AND x=10) 210 IF x=1 THEN LET a$(s,r)="A" 220 LET a$(s+4,r)=("b" AND d=1)+("c" AND d=2)+("d" AND d=3)+("e" AND d=4) 230 NEXT x 240 NEXT d 250 BEEP .5,20: PRINT AT 0,0," " 260 LET p=3: LET q=2 270 FOR g=1 TO 2 280 PRINT PAPER 5; INK 0; FLASH 1; OVER 1; INK 1;AT p-1,q;"::";AT p+2,q;"::" 290 LET g$=INKEY$: IF g$="" THEN GO TO 290 300 PRINT AT p-1,q;" ";AT p+2,q;" " 310 IF INKEY$="q" OR INKEY$="Q" THEN GO TO 680 320 LET q=q+(2 AND INKEY$="8"): IF q>26 THEN LET q=2: LET p=p+5: IF p>=20 THEN LET p=3 330 LET q=q-(2 AND INKEY$="5"): IF q<2 THEN LET q=26: LET p=p-5: IF p<3 THEN LET p=18 340 IF INKEY$="0" THEN GO TO 360 350 GO TO 280 360 IF g=2 AND r=p AND s=q THEN GO TO 280 370 IF a$((p-3)/5+1,q/2)="x" THEN GO TO 280 380 FOR k=0 TO 10 STEP 5: BEEP .008,k: NEXT k 390 IF g=1 THEN LET r=p: LET s=q 400 PRINT AT p,q;a$(INT ((p-3)/5)+1,q/2) 410 IF a$(INT ((p-3)/5)+5,q/2)="c" OR a$(INT ((p-3)/5)+5,q/2)="b" THEN INK 2 420 PRINT AT p+1,q;a$(INT ((p-3)/5)+5,q/2) 430 INK 0 440 NEXT g 450 FOR e=0 TO 150: NEXT e 460 PRINT AT r,s;" ";AT r+1,s;" ";AT p,q;" ";AT p+1,q;" " 470 IF a$((p-3)/5+1,q/2)<>a$((r-3)/5+1,s/2) THEN GO TO 570 480 FOR k=-10 TO 35 STEP 6: BEEP .01,k: NEXT k 490 LET c=c+1 500 LET a$((r-3)/5+1,s/2)="x": LET a$((r-3)/5+5,s/2)="x": LET a$((p-3)/5+1,q/2)="x": LET a$((p-3)/5+5,q/2)="x" 510 PRINT AT r,s;"x";AT r+1,s;"x";AT p,q;"x";AT p+1,q;"x" 520 IF v=1 THEN LET m=m+1 530 IF v=2 THEN LET n=n+1 540 IF v=1 THEN PRINT AT 0,0;"PLAYER 1:";m 550 IF v=2 THEN PRINT AT 0,20;"PLAYER 2:";n 560 PAUSE 50 570 LET c=c+1 580 IF INT (c/2)=c/2 THEN LET v=2 590 IF INT (c/2)<>c/2 THEN LET v=1 600 LET h$="PLAYER ": FOR h=1 TO 7: PRINT AT h+5,30;h$(h): NEXT h 610 PRINT AT 13,30;v 620 LET o1=0 630 FOR u=1 TO 4: FOR y=1 TO 13 640 IF a$(u,y)="x" THEN LET o1=o1+1 650 NEXT y: NEXT u 660 IF o1>=52 THEN GO TO 680 670 GO TO 260 680 FOR z=0 TO 2 690 FOR u=0 TO 30 STEP 4 700 BEEP .01,u 710 NEXT u: NEXT z 720 GO SUB 890 730 IF m<>n THEN PRINT AT 11,5;"PLAYER 1 HAS WON!" 740 IF n>m THEN PRINT AT 11,12;"2" 750 IF n=m THEN PRINT AT 11,9;"IT'S A DRAW!" 760 INPUT " ANOTHER GAME? "; LINE n$: IF n$="" THEN GO TO 760 770 LET n$=n$(1): IF n$="Y" OR n$="y" THEN RUN 780 IF n$="N" OR n$="n" THEN STOP 790 GO TO 760 800 CLS 810 PRINT TAB 10; INK 2;"PELMANISM";AT 0,10; OVER 1;"_________" 820 PRINT INK 4''" Can you match the card values with more skill than your opp- onent?" 830 PRINT INK 4'" You will need to remember the positions of as many cards as possible to win the game." 840 PRINT INK 5''" To move the cursor, Use:": PRINT INK 6;" 5 - Left 8 - Right" 850 PRINT INK 5'" Press 'q' to quit game" 860 PRINT '''TAB 9;"PRESS ANY KEY" 870 PAUSE 0 880 LET v=1: RETURN 890 FOR q=4 TO 1 STEP -1: FOR w=1 TO 13 900 IF a$(q+4,w)="b" OR a$(q+4,w)="c" THEN LET i=2 910 PRINT AT 21-q*5+2,w*2;a$(q,w); INK i;AT 21-q*5+3,w*2;a$(q+4,w): LET i=0: NEXT w: NEXT q 920 RETURN 930 DATA 142,145,b,b,b,b,b,142,0,102,255,b,b,126,60,24,16,56,b,124,b,56,b,16,24,b,126,255,126,b,60,24,8,b,107,127,107,8,28,b ```