Deduction game (Mastermind clone) for ST (DEDUCT.BAS)

Deduction game (Mastermind clone) for ST by Paul Pratt & Steven Evermann

Description

Deduction game (Mastermind clone) for ST by Paul Pratt & Steven Evermann

From the Antic disk of December 1986 (Vol. 5 No. 8).

The magazine article

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

BASIC listing · 6.0 KB

Text
1000  'ST Classics:  MASTERMIND
1010  '(c)1986 Antic Publishing
1020  'Written by Paul Pratt & Steven Evermann
1030  '
1040  defint A, Z:gosub KOLOR
1050  A#=GB:MOUSE=peek( A#+12 )
1060  fullw 2:clearw 2:randomize 0:TRUE=1:FALSE=0
1070  '
1080  clearw 2:color 1
1090  gotoxy 22, 0: print "#############"
1100  gotoxy 22, 1: print "#           #"
1110  gotoxy 22, 2: print "#############"
1120  TXT=4:gosub TEXT
1130  gotoxy 24, 1: print "DEDUCTION"
1140  TXT=0:gosub TEXT
1150  color 1, 8, 14
1160  gotoxy 17, 17: print " ACCEPT   REJECT";
1170  gotoxy 25, 4: print "ANSWER"
1180  'answer box
1190  C=1:F=8:BX=206:BY=35:L=38
1200  W=89:gosub BOX:fill 229, 41:fill 269, 40
1210  BY=49:L=18:W=18:F=11
1220  for BX=210 to 281 step 21
1230  gosub BOX:next
1240  'deduction box
1250  F=0:C=14:BX=203:BY=6:L=17:W=94
1260  gosub BOX
1270  'message box
1280  F=0:C=1:BX=206:BY=79:W=89:L=67
1290  gosub BOX
1300  'accept box
1310  F=7:C=1:BX=150:BY=152:W=72:L=12
1320  gosub BOX:fill 164, 158:fill 196, 157
1330  'reject box
1340  F=2:BX=222:W=72
1350  gosub BOX:fill 236, 157
1360  color 1, 11:fill 3, 100
1370  gosub MENU
1380  COLUM=13
1390  'guessing boxes
1400  W=26:F=8:L=8:C=1:COLUM=COLUM-1
1410  for BY=6 to COLUM*12-4 step 12
1420  for BX=30 to 137 step 28
1430  gosub BOX:next:next
1440  'reply boxes
1450  W=8:F=8:L=8:C=9
1460  for BY=6 to COLUM*12-4 step 12
1470  for BX=151 to 193 step 12
1480  gosub BOX:next:next
1490  gosub INITIAL
1500  'pointer
1510  F=1:C=1:BX=10:BY=8:L=4:W=17
1520  gosub BOX
1530  gosub 2350
1540  ROW=1:COLUM=1
1550  FO=7
1560  MAINLOOP:
1570  gosub RAT
1580  F=INT( ( MX-10 )\20 )
1590  IST=9+D*20
1600  if MB=1 and MX>IST and MX<150 and YOK and FO<>F then gosub CHOOSE
1610  if MB=1 and MX>222 and MX<294 and MY>173 and MO<>MX then gosub 1700
1620  if ROW =5 then gosub ACCEPT
1630  if MB=2 then 2230
1640  goto MAINLOOP
1650  CHOOSE:
1660  color 1, CO( F ):FO=F:GUS( ROW )=CO( F )
1670  fill ROW*28+14, COLUM*12-2
1680  ROW=ROW+1
1690  return
1700  REJECT:
1710  gosub 2350:
1720  if ROW>1 then ROW=ROW-1
1730  color 1, 8:FO=7
1740  fill ROW*28+14, COLUM*12-2
1750  for DELAY=1 to 10:next
1760  return
1770  BOX:
1780  color 1, F, C
1790  linef BX, BY, BX, BY+L
1800  linef BX, BY+L, BX+W, BY+L
1810  linef BX+W, BY+L, BX+W, BY
1820  linef BX+W, BY, BX, BY
1830  fill BX+2, BY+2
1840  return
1850  ACCEPT:gosub EMPTY
1860  gotoxy 23, 10: print "  ACCEPT":gotoxy 23, 12: print "    OR     "
1870  gotoxy 23, 14: print "  REJECT"
1880  gosub RAT
1890  if MB=1 and MX>149 and MX<222 and YOK then 1920
1900  if MB=1 and MX>222 and MX<294 and YOK and MO<>MX then 1700
1910  GOto 1880
1920  BLK=0:WHT=0
1930  gosub 2350:'PRINT SELECT 4 colorS
1940  for X=1 to 4
1950  if GUS( X )=PAT( X ) then BLK=BLK+1
1960  for Y=1 to 4
1970  if GUS( X )=PAT( Y ) then WHT=WHT+1
1980  next:next:WHT=WHT-BLK
1990  color 1, 0:for X=1 to WHT
2000  fill X*12+146, COLUM*12-2
2010  sound 1, 10, 3, 5, 5:sound 1, 0, 0, 0, 0
2020  next
2030  color 1, 1:for X=1 to BLK
2040  fill ( X+WHT )*12+146, COLUM*12-2
2050  sound 1, 10, 3, 6, 5:sound 1, 0, 0, 0, 0
2060  next
2070  F=11:C=11:BX=10:BY=COLUM*12-4
2080  L=4:W=17:gosub BOX
2090  ROW=1:COLUM=COLUM+1
2100  if BLK=4 then gosub WIN:goto 2230
2110  if COLUM>12 then MB=2:FO=0:return
2120  F=1:C=1:BX=10:BY=COLUM*12-4
2130  gosub BOX
2140  FO=7:return
2150  if FL=0 then TRYS=TRYS-1:gotoxy 13, 7: print TRYS
2160  INITIAL:
2170  RandOMIZE 0
2180  for X=D to 6
2190  TEMP=PAT( X )
2200  Y=INT( RND*( 7-D ) )+D
2210  PAT( X )=PAT( Y ):PAT( Y )=TEMP
2220  next:return
2230  ANSWER:
2240  for X= 1 to 4
2250  color 1, PAT( X )
2260  fill X*18+205, 51:next
2270  gosub MENU
2280  for X= 1 to 4
2290  color 1, 11
2300  fill X*18+205, 51:next
2310  if COLUM>12 then goto 1400
2320  F=11:C=11:BX=10:BY=COLUM*12-4:W=17:L=4
2330  gosub BOX
2340  goto 1400
2350  '
2360  gosub EMPTY
2370  color 11: gotoxy 23, 9: print  "RIGHT=ANSW"
2380  color 1: gotoxy 23, 10: print string$( 11, 249 )
2390  gotoxy 23, 11: print "  SELECT"
2400  gotoxy 23, 13: print "   FOUR "
2410  gotoxy 23, 15: print "  COLORS"
2420  return
2430  RAT:
2440  gemsys( 79 )
2450  MX=peek( MOUSE+2 )
2460  MY=peek( MOUSE+4 )
2470  MB=peek( MOUSE+6 )
2480  YOK=FALSE: if MY>174 and MY<186 then YOK=TRUE
2490  return
2500  KOLOR:
2510  dim KOL%( 16 )
2520  restore 2550
2530  for A=0 to 15:read B
2540  KOL%( A )=B:next
2550  data 1911, 1792, 112, 51, 775, 80
2560  data 5, 1365, 546, 101, 51, 1904
2570  data 1796, 1360, 1285, 0
2580  defdbl K: K = 1114
2590  poke K, varptr( KOL%( 0 ) )
2600  return
2610  WIN:
2620  for Y=1 to 3: for X=7 to 10: sound Y, 13, X, 5+Y, 2: next
2630  next: for Y=1 to 3: sound Y, 0, 0, 0: next
2640  return
2650  KOLORBOX:
2660  gosub EMPTY: TXT=1:gosub TEXT
2670  color 5: gotoxy 23, 9: print " RESETTING "
2680  TXT=0:gosub TEXT
2690  color 1:gotoxy 23, 10: print  STRING$( 11, 249 )
2700  gotoxy 25, 11: print  chr$( 189 );" 1986"
2710  gotoxy 23, 13: print "   PRATT  "
2720  gotoxy 23, 14: print "     &    "
2730  gotoxy 23, 15: print "  EVERMAN "
2740  restore 2800
2750  BY=152: C=1: W=12: L=12
2760  for BX=10+D*20 to 130 step 20
2770  read F: X=( ( BX-10 )/20 )
2780  CO( X )=F: PAT( X )=F
2790  gosub BOX: next
2800  data 2, 14, 7, 10, 4, 13, 12
2810  return
2820  MENU:
2830  gosub EMPTY
2840  gosub RAT: if MB<>0 then 2840
2850  TXT=1:gosub TEXT
2860  gotoxy 23, 9: print "CLICK MOUSE"
2870  TXT=0:gosub TEXT
2880  gotoxy 23, 10: print  string$( 11, 249 )
2890  gotoxy 23, 11: print "LEFT = EASY"
2900  gotoxy 23, 13: print "RIGHT= HARD"
2910  gotoxy 23, 15: print "BOTH to END"
2920  gosub RAT
2930  if MB=1 then D=1:BX=10:BY=152:C=6:F=11:W=12:L=12:gosub BOX
2940  if MB=2 then D=0
2950  if MB=3 then end
2960  if MB=0 then 2920
2970  gosub KOLORBOX
2980  return
2990  EMPTY:
3000  color 1, 0
3010  FOR X=9 to 15
3020  gotoxy 23, X: print "           "
3030  next
3040  return
3050  TEXT:
3060  poke CONTRL, 106:poke CONTRL+2, 0
3070  poke CONTRL+6, 1:poke INTIN, TXT
3080  VDISYS( 0 )
3090  return