home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 December / 1993-12.d64 / mastermind.pp (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  338b  |  9 lines

  1. 5 print"[147]":poke53280,6:poke53281,6
  2. 10 l=4:r=6:for i=1tol:d(i)=int(rnd(0)*r+1): d=d*10+d(i):next:z=1:goto30
  3. 20 z=z+1:print"b="b"w="w
  4. 30 print"guess="z:input x:print"[145]",:fori=lto1step-1:y=int(x/10):g(i)=x-y*10:x=y
  5. 40 next:w=0:b=0:for i=1tol:f(i)=d(i):if g(i)=f(i)then f(i)=0:g(i)=-1:b=b+1
  6. 50 next:for j=1tol:for i=1tol:if f(j)=g(i)then f(j)=0: g(i)=-1:w=w+1
  7. 60 next:next:if b<l then 20
  8. 70 print"correct!":end
  9.