In Decoder ben je een codekraker die een geheime code moet raden. Het spel lijkt op en is geïnspireerd door Mastermind, Bagels en "Bulls and Cows".
Codes
Licentie: U mag de onderstaande broncode alleen aanpassen voor eigen gebruik. Aangepaste versies van het onderstaande programma kunnen niet worden gedistributeerd. De namen 'Jeroen van der Gun' en 'Blijbol', en de website 'www.blijbol.nl' moeten aanwezig blijven, en moeten eenvoudig vanuit het programma te weergeven zijn. Copyright © 2007 Jeroen van der Gun.
Let op spaties voor regeleinden!
prgmDECODER
::
:Full
:Normal
:Float
:{4,4→dim([J]
:Lbl C
:ClrHome
:Disp "","","Blijbol","Happy business","","www.blijbol.nl
:For(G,1,180
:End
:Disp "","Decoder v1.0","
:For(G,1,70
:End
:Output(7,1,"(C) 2007 Jeroen
:Output(8,1,"van der Gun
:Pause
:Lbl M
:ClrHome
:Disp "DECODER","1:Start game","2:[
:If S
:Output(3,4,"*
:Output(3,5,"]May contain
:Disp " same digits","3:[
:If Z
:Output(5,4,"*
:Output(5,5,"]May begin
:Disp " with zeros","4:About
:Output(8,1,"5:Quit
:getKey
:While Ans≠92 and Ans≠105
:If Ans=22 or Ans=45 or Ans=83
:Then
:ClrHome
:Stop
:End
:If Ans=93
:Then
:If S
:Output(3,4,"
:not(S→S
:If S
:Output(3,4,"*
:End
:If Ans=94
:Then
:If Z
:Output(5,4,"
:not(Z→Z
:If Z
:Output(5,4,"*
:End
:If Ans=82
:Goto C
:getKey
:End
:ClrHome
:Output(8,1,"Thinking =40
:For(G,1,8
:Output(7,2G-1,"--
:If G<7
:Output(G,5,"= !¡ =
:End
:randInt(not(Z),9→[J](2,1
:Repeat S or [J](2,2)≠[J](2,1
:randInt(0,9→[J](2,2
:End
:Repeat S or [J](2,3)≠[J](2,2) and [J](2,3)≠[J](2,1
:randInt(0,9→[J](2,3
:End
:Repeat S or [J](2,4)≠[J](2,3) and [J](2,4)≠[J](2,2) and [J](2,4)≠[J](2,1
:randInt(0,9→[J](2,4
:End
:1→H
:0→C
:1→Y
:Output(8,1,"Guess: ****
:Lbl Y
:1→X
:Lbl X
:1→B
:getKey
:Repeat 0
:If Ans=102
:Then
:0
:Goto I
:End
:If Ans≥92 and Ans≤94
:Then
:Ans-91
:Goto I
:End
:If Ans≥82 and Ans≤84
:Then
:Ans-78
:Goto I
:End
:If Ans≥72 and Ans≤74
:Then
:Ans-65
:Goto I
:End
:If X>1 and (Ans=23 or Ans=24
:Then
:Output(Y,C+X,"
:X-1→X
:Goto X
:End
:If Ans=21 or Ans=105
:Then
:If H=4
:Then
:Output(8,1,"DIY!
:Else
:Output(8,1,"Hint
:Output(8,6,H
:Output(8,7,":
:Output(8,9+H,[J](2,H
:H+1→H
:End
:End
:If Ans=22 or Ans=45
:Then
:Output(Y,C+X,"
:Output(8,1,"Answer:
:Goto S
:End
:If B=1
:Output(Y,C+X,"+
:If B=3
:Output(Y,C+X,"·
:B+1→B
:If B=5
:1→B
:getKey
:End
:Lbl I
:Output(Y,C+X,Ans
:Ans→[J](1,X
:If X=4
:Then
:Output(8,1,"Checking
:4→F
:For(G,1,4
:[J](1,G)=[J](2,G→[J](3,G
:not(Ans→[J](4,G
:F-Ans→F
:End
:Output(Y,C+6,F
:If F=4
:Then
:Output(Y,C+7,0
:Output(8,1,"Solved!
:Goto S
:0→P
:For(G,1,4
:not([J](3,G
:For(I,1,4
:If G≠I and Ans and [J](4,I) and [J](1,G)=[J](2,I
:Then
:P+1→P
:0→[J](4,I
:End
:End
:End
:Output(Y,C+7,P
:If Y=6
:Then
:If C=9
:Then
:Output(8,1,"Failed:
:Goto S
:End
:9→C
:1→Y
:Else
:Y+1→Y
:End
:If not(F+P
:Output(8,1,"Bagels!
:If P=1 and not(F
:Output(8,1,"Pico.
:If F=1 and not(P
:Output(8,1,"Fermi.
:If F+P>1
:Then
:0→G
:While P
:If G>0
:Output(8,G,",
:Output(8,G+1,"P
:G+2→G
:P-1→P
:End
:While F
:If G>0
:Output(8,G,",
:Output(8,G+1,"F
:G+2→G
:F-1→F
:End
:Output(8,G,".
:While G<8
:G+1→G
:Output(8,G,"
:End
:End
:Goto Y
:End
:X+1→X
:Goto X
:Lbl S
:For(G,H,4
:Output(8,9+G,[J](2,G
:End
:Pause
:Goto M
Een stabiele versie van dit product is uitgebracht.
Het project is aangekondigd op 24 augustus 2007.