8-Bit Software Online Conversion

Mastermind - Listing

10REM Progname XMIND 20REM Originally a One-Liner (from a TAU disc I think) but I can't find it again to credit the author. However, 30REM all text, colours, and twiddly bits added by Paul Clucas (K6X) Oct.95 40MODE7 50*KEY10*EX. !BOOT|M 60PRINT'CHR$130" * * * * * * * * * * *" 70PRINTCHR$131" M A S T E R M I N D" 80PRINTCHR$130" * * * * * * * * * * *" 90PRINT''CHR$131;"Find the four numbe rs. The"CHR$129"right-hand"'CHR$131"colu mn shows how many are correct but"'CHR$1 31"in the wrong place, and the"CHR$130"l eft-hand"'CHR$131"column shows how many are correct and" 100PRINTCHR$131"in the correct place. Sometimes, two"'CHR$131"or more numbers can be the same!" 110PRINT:PRINTCHR$133" See how quickl y you can find them":PRINT 120DIMa 4,g 4,t 4:FORI=1TO4:a?I=RND(10 )+47:NEXT 130S%=1:REPEATPRINT,S%":"CHR$134" ";:B =0:FORI=1TO4:A=GET 140VDUA:E=A=a?I:g?I=-A*(E=0):t?I=-(E=0 )*a?I 150B=B-E:NEXT:W=0:FORG=1TO4:FORT=1TO4: V=g?G 160E=(V=t?T)*(V>0):W=W+E:g?G=-V*(E=0) 170t?T=-(E=0)*t?T:NEXT, 180PRINTCHR$130B;" "CHR$129W:S%=S%+1:U NTILB=4 190IF B=4 AND S%<12 GOSUB 220 ELSE IF B=4 GOSUB 250 200GOTO110 210: 220PRINT'CHR$129CHR$136" AMAZING!"CHR$ 134CHR$137"You only took";CHR$129CHR$136 S%-1CHR$134CHR$137"goes"'CHR$134"Call ev eryone else to see or they"'CHR$134"just won't believe it. Bet you won't"'CHR$13 4"find the next numbers so easily!" 230RETURN 240: 250PRINT'CHR$134" Well done. You to ok ";S%-1" goes."''CHR$134"Press BREAK t o return to the Menu or"'CHR$134"have an other go and try to find the"'CHR$134"an swer sooner this time." 260RETURN