User Tools

Site Tools


en:dominoes

This is an old revision of the document!


DOMINOES

Info

Author Peter Gerrard
Computer Amstrad PCW 8256 / 8512 / 9512
Year 1988
Gender Board
Controls Keyboard
Languages English
Status Preserved

Screenshots

Description

Dominoes is a board game played with numbered rectangular tiles, usually white on the face and black on the underside. The game consists of 28 pieces, the largest tile being double six.

The game is generally played by 4 players alone. You can play from 2 to 12 people by dividing the chips for it. In this game we will play against the machine.

The objective of the game is to get rid of all the tiles and if not, the one with the highest score wins. Double tiles are the only ones that are placed crosswise.

Listing

  • List - DOMINOES.BAS
10 DIM mine$(14),your$(14):a=PEEK(64504!):RANDOMIZE (a):PRINT CHR$(27)+"e"
20 rev$=CHR$(27)+CHR$(112):rof$=CHR$(27)+CHR$(113)
30 PRINT CHR$(27)+CHR$(48):cls$=CHR$(27)+"E"+CHR$(27)+"H":PRINT cls$TAB(39)rev$"* DOMINOES *"rof$:PRINT:PRINT"Traditional dominoes - just match the ends up, and I go first ..."
40 a$(1)=CHR$(150):a$(2)=CHR$(153):a$(3)=CHR$(156):a$(4)=CHR$(147):a$(5)=CHR$(149):a$(6)=CHR$(154):a$(7)=CHR$(151):a$(8)=CHR$(157):a$(9)=CHR$(155):a$(10)=CHR$(158)
50 DIM d$(7,3):FOR i=1 TO 7:FOR j=1 TO 3:READ d$(i,j):NEXT j,i
60 dom$="00010203040506111213141516222324252633343536444546555666"
70 ERASE mine$,your$:DIM mine$(14),your$(14)
80 m=0:y=0:FOR i=1 TO 24:IF i/2=INT(i/2) THEN m=m+1:a=INT(RND(1)*(29-i)+1)*2-1:mine$(m)=MID$(dom$,a,2):a$=LEFT$(mine$(m),1):b$=RIGHT$(mine$(m),1):IF VAL(a$)<VAL(b$) THEN z$=b$:b$=a$:a$=z$:mine$(m)=a$+b$:GOTO 100:ELSE 100
90 y=y+1:a=INT(RND(1)*(29-i)+1)*2-1:your$(y)=MID$(dom$,a,2)
100 dom$=LEFT$(dom$,a-1)+MID$(dom$,a+2):NEXT i
110 PRINT cls$;"Your Dominoes ...":dom$=""
120 FOR i=1 TO 14:FOR j=1 TO 13:a=VAL(mine$(j)):b=VAL(mine$(j+1)):IF a<b THEN a$=mine$(j+1):mine$(j+1)=mine$(j):mine$(j)=a$
130 NEXT j,i
140 FOR i=1 TO 12:l$=LEFT$(your$(i),1):l=VAL(l$):r$=RIGHT$(your$(i),1):r=VAL(r$):x=(i-1)*6:y=2:GOSUB 450
150 PRINT a$(1);a$(6);a$(6);a$(6);a$(3):y=y+1:GOSUB 450:GOSUB 460:NEXT:GOTO 370
160 turn=0:x=0:y=12:GOSUB 450:PRINT "Use the cursor keys to move/ENTER to select/Q if you can't go":x=2:y=1:GOSUB 450
170 test=0:FOR i=1 TO 14:IF mine$(i)="" THEN test=test+1
180 NEXT:IF test=14 THEN x=0:y=0:GOSUB 450:PRINT"I win - no more dominoes left!":computer=computer+1:GOTO 540
190 a$=INKEY$:IF a$="" THEN 190
200 IF a$=CHR$(1) AND x>2 THEN x=x-6:GOSUB 450:GOTO 190
210 IF a$=CHR$(6) AND x<80 THEN x=x+6:GOSUB 450:GOTO 190
220 IF a$="q" THEN cg=cg+1:GOTO 380:ELSE IF a$<>CHR$(13) THEN 190
230 pick=(x-2)/6+1:IF your$(pick)="" THEN 190
240 l=VAL(LEFT$(your$(pick),1)):r=VAL(RIGHT$(your$(pick),1)):IF go=0 THEN 260
250 c1=VAL(LEFT$(dom$,1)):c2=VAL(RIGHT$(dom$,1)):IF l=c1 OR l=c2 OR r=c1 OR r=c2 THEN 260 ELSE 190
260 a=x:b=y:IF go=0 THEN 310
270 x=0:y=13:GOSUB 450:PRINT "Which side, left or right (L or R) ? "
280 a$=INKEY$:IF a$<>"l" AND a$<>"r" THEN 280
290 IF a$="l" AND l=c1 OR r=c1 THEN 300 ELSE IF a$="r" AND l=c2 OR r=C2 THEN 300 ELSE 280
300 cg=0:l$=MID$(STR$(l),2):r$=MID$(STR$(r),2):IF a$="l" AND l=c1 THEN dom$=r$+l$+dom$:ELSE IF a$="r" AND l=c2 THEN dom$=dom$+l$+r$ ELSE IF a$="l" AND r=c1 THEN dom$=l$+r$+dom$ ELSE IF a$="r" AND r=c2 THEN dom$=dom$+r$+l$:ELSE 280
310 nd=nd+1:FOR y=12 TO 14:x=0:GOSUB 450:PRINT SPACE$(65):NEXT:your$(pick)="":x=a-2:y=b:FOR i=1 TO 9:y=y+1:GOSUB 450:PRINT SPACE$(5):NEXT
320 x=0:y=18:FOR i=1 TO 6:y=y+1:GOSUB 450:PRINT SPACE$(90):NEXT:x=1:y=20
330 FOR i=1 TO LEN(dom$) STEP 2:a$=MID$(dom$,i,1):b$=MID$(dom$,i+1,1)
340 IF a$=b$ THEN x=x+1:y=21:GOSUB 450:PRINT a$(6):x=x-1:y=y+1:GOSUB 450:PRINT a$(5);a$;a$(5):x=x+1:y=y+1:GOSUB 450:PRINT a$(6):x=x-1:y=y+1:GOSUB 450:PRINT a$(5);b$;a$(5):x=x+1:y=y+1:GOSUB 450:PRINT a$(6):x=x+2:GOTO 360
350 y=22:GOSUB 450:PRINT a$(6);a$(10);a$(6):y=y+1:GOSUB 450:PRINT a$;a$(5);b$:y=y+1:GOSUB 450:PRINT a$(6);a$(9);a$(6):x=x+3
360 NEXT:IF turn=0 THEN 380 ELSE 160
370 REM
380 turn=1:a=0:IF go=0 THEN go=1:dom$=LEFT$(mine$(1),1)+RIGHT$(mine$(1),1):mine$(1)="":GOTO 320
390 test=0:FOR i=1 TO 14:IF your$(i)="" THEN test=test+1
400 NEXT:IF test=14 THEN x=0:y=0:GOSUB 450:PRINT "You win - no more dominoes left!":human=human+1:GOTO 540
410 a=a+1:IF a=15 THEN x=0:y=13:GOSUB 450:PRINT "I can't go ...";SPACE$(60):FOR i=1 TO 2000:NEXT:cg=cg+1:IF cg>1 THEN 500 ELSE 160
420 l$=LEFT$(mine$(a),1):r$=RIGHT$(mine$(a),1):c$=LEFT$(dom$,1):d$=RIGHT$(dom$,1):IF l$=c$ OR l$=d$ OR r$=c$ OR r$=d$ THEN 430 ELSE 410
430 nd=nd+1:cg=0:mine$(a)="":IF l$=c$ THEN dom$=r$+l$+dom$ ELSE IF l$=d$ THEN dom$=dom$+l$+r$ ELSE IF r$=c$ THEN dom$=l$+r$+dom$ ELSE dom$=dom$+r$+l$
440 GOTO 320
450 ok=FRE(""):PRINT CHR$(27)+"Y"+CHR$(32+y)+CHR$(32+x);:RETURN
460 PRINT a$(5);d$(l+1,1);a$(5):y=y+1:GOSUB 450:PRINT a$(5);d$(l+1,2);a$(5)
470 y=y+1:GOSUB 450:PRINT a$(5);d$(l+1,3);a$(5):y=y+1:GOSUB 450:PRINT a$(7);a$(6);a$(6);a$(6);a$(8)
480 y=y+1:GOSUB 450:PRINT a$(5);d$(r+1,1);a$(5):y=y+1:GOSUB 450:PRINT a$(5);d$(r+1,2);a$(5)
490 y=y+1:GOSUB 450:PRINT a$(5);d$(r+1,3);a$(5):y=y+1:GOSUB 450:PRINT a$(4);a$(6);a$(6);a$(6);a$(2):RETURN
500 x=0:y=0:GOSUB 450:PRINT "End of game - neither of us can go.":yo=0:mi=0
510 FOR i=1 TO 14:yo=yo+VAL(LEFT$(your$(i),1))+VAL(RIGHT$(your$(i),1)):mi=mi+VAL(LEFT$(mine$(i),1))+VAL(RIGHT$(mine$(i),1)):NEXT
520 FOR i=1 TO 2000:NEXT:x=0:y=0:GOSUB 450:PRINT SPACE$(75):GOSUB 450
530 IF yo>mi THEN PRINT "You lose by"yo"to"mi:computer=computer+1:ELSE IF mi>yo THEN PRINT"I lose by"mi"to"yo:human=human+1:ELSE PRINT "A tie at"yo"points each!"
540 nd=0:cg=0:turn=0:go=0:FOR i=1 TO 3000:NEXT:GOSUB 450:PRINT SPACE$(75):GOSUB 450:PRINT"Overall score now you"human"me"computer"-another game (Y or N) ?":
550 a$=INKEY$:IF a$="y" THEN 60 ELSE IF a$="n" THEN PRINT cls$;"Bye for now":END:ELSE 550
560 DATA "   ","   ","   ","   "," ¼ ","   ","¼  ","   ","  ¼","¼  "," ¼ ","  ¼"
570 DATA "¼ ¼","   ","¼ ¼","¼ ¼"," ¼ ","¼ ¼","¼ ¼","¼ ¼","¼ ¼"

Controls

       ← = Move left
       → = Move right
       L = Place tile to the left
       R = Place token to the right
       Q = Quit game
   ENTER = Select

Loading the program

 1.- Insert the CP/M disc on side 2
 2.- Write BASIC and wait for it to load
 3.- Remove the CP/M disk and insert the disk containing the Dominoes game
 4.- Type run "Dominoes" and press the "ENTER" key

Extras

  • Program listing in high-circulation magazines of the time.

dominoes_programa_01.jpg dominoes_programa_02.jpg dominoes_programa_03.jpg dominoes_programa_04.jpg

Download

  • Dominoes (game in dsk format, compressed with zip)
en/dominoes.1655627453.txt.gz · Last modified: 2022/06/19 11:30 by jevicac