MAG Disk (Jul 1991) : Dominos / Dominos.bas

       '23nd listing 6/1/91
WINDOW 3,,,16:game=0
palette 0,0,0,1
palette 1,1,1,1
palette 2,0,0,0
palette 3,1,0.5,0
line (25,20)-(275,70),2,bf:line (325,20)-(575,70),2,bf
line (25,110)-(275,160),2,bf:line (325,110)-(575,160),2,bf
circle (87,45),4,1:paint (87,45),1,1
circle (212,45),4,1:paint (212,45),1,1

circle (340,25),4,1:paint (340,25),1,1
circle (435,65),4,1:paint (435,65),1,1
circle (465,25),4,1:paint (465,25),1,1
circle (560,65),4,1:paint (560,65),1,1

circle (40,115),4,1:paint (40,115),1,1
circle (87,135),4,1:paint (87,135),1,1
circle (135,155),4,1:paint (135,155),1,1
circle (165,115),4,1:paint (165,115),1,1
circle (212,135),4,1:paint (212,135),1,1
circle (260,155),4,1:paint (260,155),1,1

circle (340,115),4,1:paint (340,115),1,1
circle (435,115),4,1:paint (435,115),1,1
circle (465,115),4,1:paint (465,115),1,1
circle (560,115),4,1:paint (560,115),1,1
circle (340,155),4,1:paint (340,155),1,1
circle (435,155),4,1:paint (435,155),1,1
circle (465,155),4,1:paint (465,155),1,1
circle (560,155),4,1:paint (560,155),1,1
color 3:locate 11,30:print "...D O M I N O S..."
color 1:locate 23,30:input "Press enter to continue";jji$
CLS:color 3:locate 2,28
print "...D O M I N O S..."
color 1
LOCATE 12,19:INPUT "What is your Name (5 letter limit)";R$:CLS
if R$="" then R$="Playr"
IF LEN(R$)>5 THEN R$=LEFT$(R$,5)
color 3:locate 2,28:print "...D O M I N O S..."
color 1:locate 9,19:print "There are three speeds of play:":print
print "                        1.  Enter 0 for a very fast game."
print "                        2.  Enter 1 for a normal game.
print "                        3.  Enter 2 for a slow game."
locate 15,19:input "Enter 0 or 1 or 2";ite
if ite<>0 or ite<>1 or ite<>2 then ite=1
cls:color 3:locate 2,30:print "...D O M I N O S..."
color 1:locate 11,25:print R$;", do you like to Cheat...?"
locate 13,30:input "Enter Yes or No";no$
if left$(NO$,1)="Y" or left$(no$,1)="y" then ch=1  else ch=2
MENU 5,0,1,"Information"
MENU 5,1,1,"Game Information"
IF CH=1 THEN
	MENU 5,2,1,"Cheating on Computer"
	menu 5,3,1,"Cheating on Boneyard"
	end if
on menu gosub cheating
menu on
900 CLS:RANDOMIZE TIMER
TIMER ON
DIM R(30,2)         'R=INITIAL GAME DOT FORMATION ARRAY
DIM m(30)           'M=INITIAL GAME RND SELECTION ARRAY
DIM s(30,2)         'DOT ARRAY FOR DRAWING ON SCREEN    
DIM t(30)           'T=RND SELECTION ARRAY FOR DRAWING DOTS ON SCREEN 
DIM c(25,2)         'C=COMPUTER DOMINO IN PLAY ARRAY
DIM p(25,2)         'P=PLAYER DOMINO IN PLAY ARRAY
dom=1               'FIRST PLAY DOMINO           
bone=14             '14 ORIGINAL DOMINOS IN BONEYARD        
comp=7              '7 ORIGINAL COMPUTER DOMINOS          
pomp=7              '7 ORIGINAL PLAYER DOMINOS         
p4=INT(2000*RND)+1:FOR se=1 TO p4:NEXT 
GOSUB SHUFFLE
FOR vt=1 TO 7
  cscore=cscore+p(vt,1)+p(vt,2)
  pscore=pscore+c(vt,1)+c(vt,2)
  NEXT vt
LOCATE 18,2:PRINT R$;"'s";" Dominos";
LOCATE 22,2:PRINT "Computer's Dominos";
LINE (3,132)-(630,195),3,B:LINE (2,132)-(2,195),3
LINE (3,163)-(631,163),3:LINE (3,179)-(631,179),3:LINE (631,132)-(631,195),3
LINE (225,179)-(225,195),3:LINE (226,179)-(226,195),3
LINE (458,179)-(458,195),3:LINE (459,179)-(459,195),3
FOR gt=1 TO 14:R(m(gt),1)=9:R(m(gt),2)=9:NEXT gt  
GOSUB STARTGAME              
IF play=1 THEN GOSUB PLAYERDOMINO
IF play=2 THEN GOSUB COMPDRAW:GOSUB PLAYERDOMINO:x=40:y=21        
locate 24,2:print "Computer Score=";cscore;
locate 24,31:print R$;"'s Score=";pscore;
locate 24,60:print  "Boneyard No.=";bone;
GOSUB gameplay 
END

STARTGAME:        'DETERMINES WHO STARTS GAME
  COLOR 3
  FOR V1=6 TO 0 STEP -1   'SEES WHO HAS HIGHEST DOUBLET
  FOR U=1 TO 7
  IF (p(U,1)=p(U,2)) AND p(U,1)=V1 THEN 
      play=1:dot=p(U,1):LOCATE 11,30:PRINT R$;" Starts Game":PRINT 
      PRINT TAB (9)"Click Left Mouse on the Player Domino with";p(U,1);"-";p(U,1);"Dot Arrangement"
      SOUND 880,2:x=160:y=169:FOR a=1 TO 7:LINE (x,y)-(x+16,y+6),2,BF
      x=x+24:NEXT a:RETURN
      END IF
  IF (c(U,1)=c(U,2)) AND c(U,1)=V1 THEN 
      dot=c(U,1):t1=TIMER:play=2:LOCATE 11,27:PRINT "Computer Starts Game"
      SOUND 880,2:GOTO 190
      END IF
  NEXT U
  NEXT V1
190 FOR t=1 TO 7:s(t,1)=c(t,1):s(t,2)=c(t,2):NEXT t  
  FOR  PO=1 TO 4000:t2=TIMER:x=15:y=21:a=U
    IF ply=0 AND INT(t2-t1)=2 THEN 
      LINE (60,50)-(600,130),0,BF:LINE (x,y+10)-(x+25,y-10),2,BF
      GOSUB VERTDOTS:dom=dom+1:GOSUB CDRAW:RETURN   
      END IF
  NEXT PO                                             
  RETURN    

gameplay:        'SUB FOR PLAYING GAME
  IF ply=0 THEN GOTO 200                      
   IF pomp=0 THEN R=1:GOSUB winner
  FOR Z1=1 TO pomp
    IF p(Z1,1)=dot OR p(Z1,2)=dot AND ply<>0 THEN R=1:GOSUB whoplay:GOTO 200
    NEXT Z1
  z6=pomp:z7=bone:r=3:gosub whoplay
  FOR R9=1 TO 28         
  IF R(m(R9),1)<=6 OR R(m(R9),2)<=6  THEN     
      pomp=pomp+1:bone=bone-1                   'ADDS DOMINOS TO PLAYERS PILE
      p(pomp,1)=R(m(R9),1):p(pomp,2)=R(m(R9),2)
      R(m(R9),1)=9:R(m(R9),2)=9
   IF p(pomp,1)=dot OR p(pomp,2)=dot THEN
      horiz=x:vert=y:add=1:r=5:gosub whoplay:gosub playerdomino  'add=1 is delay timer for display
      x=horiz:y=vert:r=1:add=0:gosub whoplay:goto 200
      END IF
      end if 
  NEXT R9
  locate 24,73:print bone;
  horiz=x:vert=y:gosub playerdomino
  x=horiz:y=vert:R=1:GOSUB whoplay
  IF bone=0 AND (p(pomp,1)<>dot OR p(pomp,2)<>dot) THEN 
      R=4:GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOTO gameplay
      END IF
200 WHILE MOUSE(0)=0:WEND
  xx=MOUSE(3):YY=MOUSE(4)
  IF ply=0 THEN                     
        LEFT=134+(51*(U-1))+4*(U-1):RIGHT=134+(51*(U-1))+4*(U-1)+51
        TOP=135:BOTTOM=145         'TOP DOMINO ROW
        END IF
  IF ply=0 AND xx>LEFT AND xx<RIGHT AND YY>TOP AND YY<BOTTOM THEN
        LINE (60,50)-(629,130),0,BF:x=15:y=21:a=U
        LINE (x,y+10)-(x+25,y-10),2,BF:GOSUB VERTDOTS:p(U,1)=7:p(U,2)=7
        dom=dom+1
        GOSUB PLAYERDOMINO:pomp=pomp-1:R=2:x=40:y=21:ply=90:GOSUB whoplay
        GOSUB computerdomino
        END IF
  
  IF ply=0 THEN GOTO gameplay
   
  FOR a=1 TO pomp          'LOOP IS FOR PLAYING AFTER FIRST MOVE
  
  IF a<=9 THEN LEFT=134+(51*(a-1))+4*(a-1):RIGHT=134+(51*(a-1))+4*(a-1)+51
  IF a>=10 THEN LEFT=134+(51*(a-1-9))+4*(a-1-8):RIGHT=134+(51*(a-1-9))+4*(a-1-9)+51
     IF (xx>LEFT AND xx<RIGHT) AND (YY>135 AND YY<145) AND xx<>zz AND a<=9 THEN ben=1 ELSE ben=0
     IF (xx>LEFT AND xx<RIGHT) AND (YY>149 AND YY<159) AND xx<>zz AND a>=10 THEN bent=2 ELSE bent=0    
                 'DOMINOS 1-10 ARE TOP HORIZONTAL ROW ON SCREEN
                 'DOMINOS 24-28 ARE LOWEST HORIZONTAL ROW ON SCREEN
IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND (dom<=10 OR dom>=24) THEN 
      LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB horizDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+51:y=vert:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
  
IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND (dom<=10 OR dom>=24)  THEN 
      LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB horizDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+51:y=vert:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
  
IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND (dom<=10 OR dom>=24) THEN
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+25:y=vert:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
                 'DOMINOS 11-13 ARE VERTICAL RIGHT ROW ON SCREEN
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND dom=11 THEN 
      y=26:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
   
   IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND dom=11  THEN 
      y=26:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
  
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND dom=11 THEN
      y=21:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND (dom=12 OR dom=22) THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND (dom=12 OR dom=22) THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND (dom=12 OR dom=22) THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,1)
      s(a,2)=p(a,2):GOSUB horizDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2)
      p(a,1)=7:p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+13:y=vert+15
      R=2:GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
                
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND dom=13 THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+5:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

   IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND dom=13 THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+5:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
   
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND dom=13 THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,1)
      s(a,2)=p(a,2):GOSUB horizDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2)
      p(a,1)=7:p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert
      R=2:GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
                 'DOMINOS 14-20 ARE MIDDLE HORIZONTAL ROW ON SCREEN
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND (dom>=14 AND dom<=20) THEN 
      x=x-51:horiz=x:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB horizDOTS:dom=dom+1:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

   IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND (dom>=14 AND dom<=20) THEN 
      x=x-51:horiz=x:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB horizDOTS:dom=dom+1:vert=y:dot=p(a,1):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
  
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND (dom>=14 AND dom<=20) THEN
      x=x-25:horiz=x:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:vert=y:dot=p(a,2):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
                'DOMINOS 21-23 ARE LEFT VERTICAL ROW ON SCREEN
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND dom=21 THEN 
      x=x-25:y=y+5:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
   
   IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND dom=21  THEN 
      x=x-25:y=y+5:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
  
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND dom=21 THEN
      x=x-25:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7
      p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz:y=vert+20:R=2
      GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)<>p(a,2) AND dom=23 THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,1):s(a,2)=p(a,2)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+25:y=vert+5:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF

   IF (ben=1 OR bent=2) AND p(a,2)=dot AND p(a,1)<>p(a,2) AND dom=23 THEN 
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=p(a,2):s(a,2)=p(a,1)
      GOSUB VERTDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,1):p(a,1)=7:p(a,2)=7
      GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+25:y=vert+5:R=2:GOSUB whoplay
      GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
   
   IF (ben=1 OR bent=2) AND p(a,1)=dot AND p(a,1)=p(a,2) AND dom=23 THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=p(a,1)
      s(a,2)=p(a,2):GOSUB horizDOTS:dom=dom+1:horiz=x:vert=y:dot=p(a,2)
      p(a,1)=7:p(a,2)=7:GOSUB PLAYERDOMINO:pomp=pomp-1:x=horiz+51:y=vert
      R=2:GOSUB whoplay:GOSUB tim:GOSUB computerdomino:GOSUB tim:GOTO gameplay
      END IF
          
 NEXT a
  GOSUB tim
  GOTO gameplay
  RETURN

PLAYERDOMINO:     'DRAWING OF PLAYER DOMINOS ON LOWER SCREEN
  zz=xx:cscore=0 
  FOR Z=1 TO pomp-1
    IF p(Z,1)=7 THEN 
       p(Z,1)=p(Z+1,1)
       p(Z,2)=p(Z+1,2)
       p(Z+1,1)=7
       p(Z+1,2)=7
       END IF
    NEXT Z
  x=134:FOR t=1 TO pomp:s(t,1)=p(t,1):s(t,2)=p(t,2):NEXT t                
  LINE (133,133)-(629,160),0,BF
  FOR a=1 TO pomp
  IF p(a,1)=7 OR p(a,2)=7 THEN GOTO 340
  IF a<=9 THEN y=140         'TOP ROW OF PLAYER DOMINOS
  IF a=10 THEN x=134:y=154   'BOTTOM ROW OF PLAYER DOMINOS
  LINE (x,y-5)-(x+51,y+5),2,BF          
  GOSUB horizDOTS                      
  x=x+55:cscore=cscore+p(a,1)+p(a,2)
  COLOR 1:LOCATE 24,17:PRINT cscore;
  t11=timer
  if add=1 and a>=z6 then
        while int(t12-t11)<1
        t12=timer
        wend
        z7=z7-1:sound 880,2:locate 24,73:print z7;    'z7=bone
        end if
340  NEXT a
locate 24,73:print bone; 
IF pomp=0 THEN R=1:GOSUB winner  
  RETURN

computerdomino:   'DRAWS FULL SIZE COMPUTER DOMINOS ON SCREEN
 FOR t=1 TO comp:s(t,1)=c(t,1):s(t,2)=c(t,2):NEXT t
 FOR a=1 TO comp
              'DOMINOS 1-10 ARE TOP HORIZONTAL ROW ON SCREEN
              'DOMINOS 11-13 ARE RIGHT VERTICAL ROW ON SCREEN
              'DOMINOS 14-20 ARE MIDDLE HORIZONTAL ROW ON SCREEN
              'DOMINOS 21-23 ARE LEFT VERTICAL ROW ON SCREEN
              'DOMINOS 24-28 ARE LOWEST HORIZONTAL ROW ON SCREEN

IF c(a,1)=dot AND c(a,1)=c(a,2) AND (dom<=10 OR dom>=24) THEN gosub check
IF YU=1 THEN YU=0:GOTO 40
if c(a,1)=dot and c(a,1)=c(a,2) and (dom<=10 or dom>=24) then
      LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:x=x+25:dot=c(a,2)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
 
if c(a,1)=dot and c(a,1)<>c(a,2) and (dom<=10 or dom>=24) then gosub check
if yu=1 then YU=0:GOTO 40
If c(a,1)=dot AND c(a,1)<>c(a,2) AND (dom<=10 OR dom>=24) THEN 
      LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB horizDOTS:dom=dom+1:x=x+51:dot=c(a,2)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
  
if c(a,2)=dot and c(a,1)<>c(a,2) and (dom<=10 or dom>=24) then gosub check
IF YU=1 THEN YU=0:GOTO 40
IF c(a,2)=dot AND c(a,1)<>c(a,2) AND (dom<=10 OR dom>=24) THEN
      LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB horizDOTS:dom=dom+1:x=x+51:dot=c(a,1)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
  
IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND DOM=11 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF  c(a,1)=dot AND c(a,1)<>c(a,2) AND dom=11 THEN 
      y=26:LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
  
IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND DOM=11 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF c(a,2)=dot AND c(a,1)<>c(a,2) AND dom=11 THEN
      y=26:LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,1):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)=c(a,2) AND dom=11 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)=C(A,2) AND DOM=11 THEN
      y=21:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)<>c(a,2) AND (dom=12 OR dom=22) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND (DOM=12 OR DOM=22) THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,2)=dot AND c(a,1)<>c(a,2)  AND (dom=12 OR dom=22) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND (DOM=12 OR DOM=22) THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,1):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)=c(a,2) AND (dom=12 OR dom=22) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)=C(A,2) AND (DOM=12 OR DOM=22) THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,1)
      s(a,2)=c(a,2):GOSUB horizDOTS:dom=dom+1:dot=c(a,2):x=x+13:y=y+15
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)<>c(a,2) AND dom=13 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND DOM=13 THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+5
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,2)=dot AND c(a,1)<>c(a,2) AND dom=13 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND DOM=13 THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,1):y=y+5
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF


IF c(a,1)=dot AND c(a,1)=c(a,2) AND dom=13 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)=C(A,2) AND DOM=13 THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,1)
      s(a,2)=c(a,2):GOSUB horizDOTS:dom=dom+1:dot=c(a,2)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
    
IF c(a,1)=dot AND c(a,1)<>c(a,2) AND (dom>=14 AND dom<=20) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND (DOM>=14 AND DOM<=20) THEN
      x=x-51:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,2)
      s(a,2)=c(a,1):GOSUB horizDOTS:dom=dom+1:dot=c(a,2)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,2)=dot AND c(a,1)<>c(a,2) AND (dom>=14 AND dom<=20) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND (DOM>=14 AND DOM<=20) THEN
      x=x-51:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,1)
      s(a,2)=c(a,2):GOSUB horizDOTS:dom=dom+1:dot=c(a,1)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)=c(a,2) AND (dom>=14 AND dom<=20) THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)+C(A,2) AND (DOM>=14 AND DOM<=20) THEN
      x=x-25:LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1)
      s(a,2)=c(a,2):GOSUB VERTDOTS:dom=dom+1:dot=c(a,1)
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)<>c(a,2) AND dom=21 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND DOM=21 THEN
      x=x-25:y=y+5:LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
  
IF c(a,2)=dot AND c(a,1)<>c(a,2) AND dom=21 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND DOM=21 THEN
      x=x-25:y=y+5:LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,1):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)=c(a,2) AND dom=21 THEN GOSUB CHECK
IF YU=1 THEN YU=0:GOTO 40
IF C(A,1)=DOT AND C(A,1)=C(A,2) AND DOM=21 THEN
      x=x-25:LINE (x,y+10)-(x+25,y-10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):y=y+20
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)<>c(a,2) AND dom=23 THEN GOSUB CHECK
   IF YU=1 THEN YU=0:GOTO 40
   IF C(A,1)=DOT AND C(A,1)<>C(A,2) AND DOT=23 THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,1):s(a,2)=c(a,2)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,2):x=x+25:y=y+5
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

 IF c(a,2)=dot AND c(a,1)<>c(a,2) AND dom=23 THEN GOSUB CHECK
    IF YU=1 THEN YU=0:GOTO 40
    IF C(A,2)=DOT AND C(A,1)<>C(A,2) AND DOM=23 THEN
      LINE (x,y-10)-(x+25,y+10),2,BF:s(a,1)=c(a,2):s(a,2)=c(a,1)
      GOSUB VERTDOTS:dom=dom+1:dot=c(a,1):x=x+25:y=y+5
      GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF

IF c(a,1)=dot AND c(a,1)=c(a,2) AND dom=23 THEN GOSUB CHECK
    IF YU=1 THEN YU=0:GOTO 40
    IF C(A,1)=DOT AND C(A,1)=C(A,2) AND DOM=23 THEN
      x=x-13:y=y-5:LINE (x,y-5)-(x+51,y+5),2,BF:s(a,1)=c(a,1)
      s(a,2)=c(a,2):GOSUB horizDOTS:dom=dom+1:dot=c(a,2)
      x=x+51:GOSUB CDRAW:GOSUB COMPDRAW:Y2=0:Y3=0:RETURN
      END IF
40  NEXT a
IF Y2=2 THEN Y3=3:YU=0:GOTO COMPUTERDOMINO  'A MATCH WAS FOUND ON FIRST ROUND
  FOR R9=1 TO 28         
  IF R(m(R9),1)<=6 OR R(m(R9),2)<=6 THEN   
      comp=comp+1                          'ADDS DOMINOS TO COMPUTERS PILE
      c(comp,1)=R(m(R9),1):c(comp,2)=R(m(R9),2)
      R(m(R9),1)=9:R(m(R9),2)=9:bone=bone-1
      LOCATE 24,73:PRINT bone;
      GOSUB COMPDRAW:SOUND 880,2
      GOTO computerdomino
      END IF 
  NEXT R9
  IF R=4 AND bone=0 THEN GOSUB winner
  RETURN


CDRAW:                   'RENUMBERS USED COMPUTER DOMINOS IN ITS ARRAY
    c(a,1)=8:c(a,2)=8:SOUND 880,2
    FOR LIK=1 TO comp-1
      IF LIK=comp THEN RETURN
      IF c(LIK,1)=8 OR c(LIK,2)=8 THEN
          c(LIK,1)=c(LIK+1,1)
          c(LIK,2)=c(LIK+1,2)
          c(LIK+1,1)=8
          c(LIK+1,2)=8
          END IF
    NEXT LIK
    comp=comp-1
    RETURN
          

COMPDRAW:         'DRAWS LITTLE COMPUTER DOMINOS ON LOWER SCREEN
  pscore=0             
  IF ply=0 AND play=2 THEN comp=6
  X9=160:Y9=169:ply=90
  LINE (159,168)-(620,176),0,BF    
  FOR AT=1 TO comp
  pscore=pscore+c(AT,1)+c(AT,2)       
  LINE (X9,Y9)-(X9+16,Y9+6),2,BF:X9=X9+24:NEXT AT
  COLOR 1:LOCATE 24,40+LEN(R$):PRINT pscore;
  IF comp=0 THEN R=2:GOSUB winner
    RETURN

whoplay:            'SHOWS WHOSE TURN TO PLAY NEXT ON UPPER LEFT SCREEN
 LINE (0,0)-(635,10),0,BF
  LOCATE 1,2:COLOR 3
  IF R=1 THEN PRINT R$;"'s";" turn to Play..."
  IF R=2 THEN PRINT "Computer's turn to Play..."
  if r=3 then print "Checking ";r$;"'s";" dominos"
  IF R=4 THEN PRINT "The Boneyard is empty, ";R$;" is unable to Play, therefore Computer will Play":SOUND 880,2
  if r=5 then 
    print R$;", you have to draw from the Boneyard since you don't have a";dot
    end if
  COLOR 1                   
  RETURN

CHECK:              'COMPUTER CHECKING DOMINOS 
if y3=3 then yu=0:return
FOR GT=1 TO POMP
IF C(A,1)=DOT AND (P(GT,1)=C(A,2) OR P(GT,2)=C(A,2)) THEN YU=1:Y2=2:RETURN
IF C(A,2)=DOT AND (P(GT,1)=C(A,1) OR P(GT,2)=C(A,1)) THEN YU=1:Y2=2:RETURN
NEXT GT
RETURN

CHEATING:                
IF MENU(1)=1 THEN GOSUB Information
IF MENU(1)=2 and ch=1 THEN GOSUB OPPCHEATER    'ch=1 player cheats on oppnt
IF MENU(1)=3 and ch=1 THEN GOSUB BONECHEATER   'ch=1 player cheats on byard
RETURN

Information:     'SHOWS GAMES PLAYED
WINDOW 6,"       .....Game Information.....",(10,10)-(375,75),16
d=p+c:PRINT
PRINT "Games Played:  ";c+p
IF d<1 THEN d=1
PRINT "Computer Wins:  ";c
print R$;" Wins:  ";p
PRINT r$;" wins";int((p/(d))*100);"percent of the time."
PRINT
INPUT "Enter any key to continue";gt$
WINDOW CLOSE 6
RETURN
  
OPPCHEATER:       'LOOKS AT COMPUTERS DOMINOS
WINDOW 4,"    .....Why are You Cheating.....",(10,10)-(350,180),16
PRINT "The Computer has the following dominos:":PRINT:hi=1
FOR gy=1 TO comp
PRINT  TAB(15) c(gy,1);c(gy,2)
hi=hi+1:NEXT:PRINT
INPUT "Enter any key to continue";fr$
WINDOW CLOSE 4
RETURN
  
BONECHEATER:      'LOOKS AT DOMINOS IN BONEYARD
WINDOW 5,"    .....Why are You Cheating.....",(10,10)-(350,180),16
If bone=0 then 
	print "The Boneyard is empty.........."
	print:print:print:print:print
	goto 678
	end if
PRINT "The Boneyard has the following Dominos:":PRINT
FOR gy=1 TO 28
IF R(m(gy),1)<=6 OR R(m(gy),2)<=6 THEN
  PRINT TAB(15) R(m(gy),1);R(m(gy),2)
  END IF
  NEXT gy
678  INPUT "Enter any key to continue";fo$
  WINDOW CLOSE 5
  RETURN
  
SHUFFLE:      'DOMINO ARRAY FORMATION
  FOR a=1 TO 28                    
  READ R(a,1):READ R(a,2):NEXT a:RESTORE     
  FOR i=1 TO 28:m(i)=i:NEXT i
  FOR i=1 TO 28:x=INT(28*RND)+1
  TP=m(i):m(i)=m(x):m(x)=TP:NEXT i
  FOR t1=1 TO 7:p(t1,1)=R(m(t1),1):p(t1,2)=R(m(t1),2)
    NEXT t1  
  FOR t2=1 TO 7:c(t2,1)=R(m(t2+7),1):c(t2,2)=R(m(t2+7),2)
    NEXT t2
  DATA 0,0,0,1,0,2,0,3,0,4,0,5,0,6  
  DATA 1,1,1,2,1,3,1,4,1,5,1,6      
  DATA 2,2,2,3,2,4,2,5,2,6          
  DATA 3,3,3,4,3,5,3,6              
  DATA 4,4,4,5,4,6                  
  DATA 5,5,5,6                      
  DATA 6,6                          
  RETURN

horizDOTS:     'DOMINO DOTS IN HORIZONTAL LAYOUT  
IF s(a,1)=1 THEN  PSET (x+12,y),1:PSET (x+13,y),1
IF s(a,1)=2 THEN  
        PSET (x+4,y-3),1:PSET (x+5,y-3),1
        PSET (x+20,y+3),1:PSET (x+21,y+3),1
        END IF
IF s(a,1)=3 THEN
        PSET (x+4,y-3),1:PSET (x+5,y-3),1:PSET (x+12,y),1
        PSET (x+13,y),1:PSET (x+20,y+3),1:PSET (x+21,y+3),1
        END IF
IF s(a,1)=4 THEN
        PSET (x+4,y-3),1:PSET (x+5,y-3),1:PSET (x+20,y-3),1
        PSET (x+21,y-3),1:PSET (x+4,y+3),1
        PSET (x+5,y+3),1:PSET (x+20,y+3),1:PSET (x+21,y+3),1
        END IF 
IF s(a,1)=5 THEN
        PSET (x+4,y-3),1:PSET (x+5,y-3),1:PSET (x+20,y-3),1
        PSET (x+21,y-3),1:PSET (x+12,y),1:PSET (x+13,y),1
        PSET (x+4,y+3),1:PSET (x+5,y+3),1:PSET (x+20,y+3),1
        PSET (x+21,y+3),1
        END IF 
IF s(a,1)=6 THEN  
        PSET (x+4,y-3),1:PSET (x+5,y-3),1:PSET (x+12,y-3),1
        PSET (x+13,y-3),1:PSET (x+20,y-3),1:PSET (x+21,y-3),1
        PSET (x+4,y+3),1:PSET (x+5,y+3),1:PSET (x+12,y+3),1
        PSET (x+13,y+3),1:PSET (x+20,y+3),1:PSET (x+21,y+3),1
        END IF 
IF s(a,2)=1 THEN  PSET (x+12+25,y),1:PSET (x+13+25,y),1
IF s(a,2)=2 THEN
        PSET (x+4+25,y-3),1:PSET (x+5+25,y-3),1
        PSET (x+20+25,y+3),1:PSET (x+21+25,y+3),1
        END IF
IF s(a,2)=3 THEN
        PSET (x+4+25,y-3),1:PSET (x+5+25,y-3),1
        PSET (x+12+25,y),1:PSET (x+13+25,y),1
        PSET (x+20+25,y+3),1:PSET (x+21+25,y+3),1
        END IF
IF s(a,2)=4 THEN
        PSET (x+4+25,y-3),1:PSET (x+5+25,y-3),1
        PSET (x+20+25,y-3),1:PSET (x+21+25,y-3),1
        PSET (x+4+25,y+3),1:PSET (x+5+25,y+3),1
        PSET (x+20+25,y+3),1:PSET (x+21+25,y+3),1
        END IF 
IF s(a,2)=5 THEN
        PSET (x+4+25,y-3),1:PSET (x+5+25,y-3),1:PSET (x+20+25,y-3),1
        PSET (x+21+25,y-3),1:PSET (x+12+25,y),1:PSET (x+13+25,y),1
        PSET (x+4+25,y+3),1:PSET (x+5+25,y+3),1
        PSET (x+20+25,y+3),1:PSET (x+21+25,y+3),1
        END IF 
IF s(a,2)=6 THEN
        PSET (x+4+25,y-3),1:PSET (x+5+25,y-3),1:PSET (x+12+25,y-3),1
        PSET (x+13+25,y-3),1:PSET (x+20+25,y-3),1:PSET (x+21+25,y-3),1
        PSET (x+4+25,y+3),1:PSET (x+5+25,y+3),1:PSET (x+12+25,y+3),1
        PSET (x+13+25,y+3),1:PSET (x+20+25,y+3),1:PSET (x+21+25,y+3),1
        END IF 
RETURN

VERTDOTS:  'DOMINO DOTS IN VERTICAL LAYOUT
                   
IF s(a,1)=1 THEN PSET(x+12,y-5),1:PSET(x+13,y-5),1
IF s(a,1)=2 THEN 
         PSET(x+4,y-8),1:PSET(x+5,y-8),1
         PSET(x+20,y-2),1:PSET(x+21,y-2),1
         END IF
IF s(a,1)=3 THEN 
         PSET(x+4,y-8),1:PSET(x+5,y-8),1:PSET(x+12,y-5),1
         PSET(x+13,y-5),1:PSET(x+20,y-2),1:PSET(x+21,y-2),1
         END IF
IF s(a,1)=4 THEN
         PSET(x+4,y-2),1:PSET(x+5,y-2),1:PSET(x+20,y-2),1
         PSET(x+21,y-2),1:PSET(x+4,y-8),1:PSET(x+5,y-8),1
         PSET(x+20,y-8),1:PSET(x+21,y-8),1
         END IF
IF s(a,1)=5 THEN
         PSET(x+4,y-2),1:PSET(x+5,y-2),1:PSET(x+20,y-2),1
         PSET(x+21,y-2),1:PSET(x+12,y-5),1:PSET(x+13,y-5),1
         PSET(x+4,y-8),1:PSET(x+5,y-8),1
         PSET(x+20,y-8),1:PSET(x+21,y-8),1
         END IF
IF s(a,1)=6 THEN 
         PSET(x+4,y-2),1:PSET(x+5,y-2),1:PSET(x+20,y-2),1
         PSET(x+21,y-2),1:PSET(x+4,y-5),1:PSET(x+5,y-5),1
         PSET(x+20,y-5),1:PSET(x+21,y-5),1:PSET(x+4,y-8),1
         PSET(x+5,y-8),1:PSET(x+20,y-8),1:PSET(x+21,y-8),1
         END IF
                    
IF s(a,2)=1 THEN PSET(x+12,y+5),1:PSET(x+13,y+5),1
IF s(a,2)=2 THEN
         PSET(x+4,y+2),1:PSET(x+5,y+2),1
         PSET(x+20,y+8),1:PSET(x+21,y+8),1
         END IF
IF s(a,2)=3 THEN 
         PSET(x+4,y+2),1:PSET(x+5,y+2),1:PSET(x+12,y+5),1
         PSET(x+13,y+5),1:PSET(x+20,y+8),1:PSET(x+21,y+8),1
         END IF
IF s(a,2)=4 THEN
         PSET(x+4,y+2),1:PSET(x+5,y+2),1:PSET(x+20,y+2),1
         PSET(x+21,y+2),1:PSET(x+4,y+8),1:PSET(x+5,y+8),1
         PSET(x+20,y+8),1:PSET(x+21,y+8),1
         END IF
IF s(a,2)=5 THEN
         PSET(x+4,y+2),1:PSET(x+5,y+2),1:PSET(x+20,y+2),1
         PSET(x+21,y+2),1:PSET(x+12,y+5),1:PSET(x+13,y+5),1
         PSET(x+4,y+8),1:PSET(x+5,y+8),1:PSET(x+20,y+8),1
         PSET(x+21,y+8),1
         END IF
IF s(a,2)=6 THEN
         PSET(x+4,y+2),1:PSET(x+5,y+2),1:PSET(x+20,y+2),1
         PSET(x+21,y+2),1:PSET(x+4,y+5),1:PSET(x+5,y+5),1
         PSET(x+20,y+5),1:PSET(x+21,y+5),1:PSET(x+4,y+8),1
         PSET(x+5,y+8),1:PSET(x+20,y+8),1:PSET(x+21,y+8),1
         END IF
   RETURN

tim:     'DELAY TIMER TO SLOW DOWN COMPILER
  IF pomp=0 THEN R=1:GOSUB winner
  if ite=0 then return
  T6=TIMER
    WHILE INT(T7-T6)<ite+1
    T7=TIMER
    IF INT(T7-T6)=ite+1  THEN RETURN
    WEND
  RETURN

winner:       'GAME WINNING STATEMENT
t4=TIMER
WHILE  INT(t5-t4)<3
t5=TIMER
IF INT(t5-t4)=3 THEN GOTO 1234
WEND
1234 LINE (100,40)-(540,100),2,BF:COLOR 3,2
IF R=1 THEN
    p=p+1:LOCATE  8,34:PRINT R$;" Wins"
    LOCATE 11,22:INPUT "Enter any key to start another game";jy$
    END IF
IF R=2 THEN
    c=c+1:LOCATE 8,32:PRINT "Computer Wins"  
    LOCATE 11,22:INPUT "Enter any key to start another game";jy$
    END IF
IF R=4 THEN
    LOCATE 7,24:PRINT "Neither player has a ";dot;", therefore";
    IF cscore>pscore THEN 
       c=c+1:LOCATE 9,21
       PRINT "The Computer wins with a higher score of";cscore
       LOCATE 12,21:INPUT "Enter any key to start another game";ft$
       END IF
    IF pscore>cscore THEN
       p=p+1:LOCATE 9,23
       PRINT R$;" wins with a higher score of ";pscore
       LOCATE 12,21:INPUT "Enter any key to start another game";ft$
       END IF
    END IF
  CLS:COLOR 1,0:cscore=0:pscore=0:play=0:ply=0:vt=0:dom=0:bone=0:comp=0
  pomp=0:se=0:p4=0:x=0:y=0:R=0:m=0:dot=0:a=0:horiz=0:vert=0:YU=0:Y2=0
  ben=0:bent=0:hi=0:gy=0:i=0:t1=0:t2=0:t3=0:t4=0:t5=0:d=0
  ERASE R,m,s,t,c,p
  GOTO 900
  RETURN