Hello. This is an update to my first post, which is since long gone. I have successfully developed and tested a fully functioning code for mastermind in TI-Basic.
However, this basic is for the TI-92 family. I have notes included on how to possibly do it in the TI-84 family, but not 100% sure, so don’t quote me on anything, as I have not built this code for it or have tested that version of code. However, the TI-89 titanium should handle well with this code.
Feel free to do whatever you want with this code. I, however, am not responsible for the misuse of this code for malicious intents or any other equally inappropriate use.
Code is below for convenience:
(Notes are denoted with a //: before them)
(To end game because guess limit reached, enter 3.14. That will direct you to the Game over sequence)
Code:
However, this basic is for the TI-92 family. I have notes included on how to possibly do it in the TI-84 family, but not 100% sure, so don’t quote me on anything, as I have not built this code for it or have tested that version of code. However, the TI-89 titanium should handle well with this code.
Feel free to do whatever you want with this code. I, however, am not responsible for the misuse of this code for malicious intents or any other equally inappropriate use.
Code is below for convenience:
(Notes are denoted with a //: before them)
(To end game because guess limit reached, enter 3.14. That will direct you to the Game over sequence)
Code:
mastmind() (//:not necessary for 84 family)
Prgm (//: also not necessary for 84 family)
ClrIO (//:ClrHome for 84)
Local a,b,c,d,e,v,w,x,y,z
Lbl f
rand(9)-->a (:// Can change to add more or less variables as well as rand possibilities.)
rand(9)-->b
rand(9)-->c
rand(9)-->d
rand(9)-->e
Disp “Welcome to Mastermind”
Disp “You have 15 guesses”
Disp “Otherwise it is game over”
Disp “Your time starts now”
Loop (//: Lbl for 84 family, can omit loop)
Input “z=”,z
If z<a Then
Disp “Too Low”
EndIf
If z>a Then
Disp “Too High”
EndIf
If z=3.14 Then
Disp “Game Over”
Goto u
EndIf
If z=a Then
Disp “Next level”
Goto g
EndIf
EndLoop (//:Doesn’t exist in 84. I don’t think it is necessary so can be omitted in that family)
(//: I think Goto (letter) works for 84 family)
Lbl g
Loop (//: Lbl for 84 family, can omit loop)
Input “y=”,y
If y<b Then
Disp “Too Low”
EndIf
If y>b Then
Disp “Too High”
EndIf
If y=3.14 Then
Disp “Game Over”
Goto u
EndIf
If y=b Then
Disp “Next level”
Goto h
EndIf
EndLoop (//:Doesn’t exist in 84. I don’t think it is necessary so can be omitted in that family)
Lbl h
Loop (//: Lbl for 84 family, can omit loop)
Input “x=”,x
If x<c Then
Disp “Too Low”
EndIf
If x>c Then
Disp “Too High”
EndIf
If x=3.14 Then
Disp “Game Over”
Goto u
EndIf
If x=c Then
Disp “Next level”
Goto i
EndIf
EndLoop (//:Doesn’t exist in 84. I don’t think it is necessary so can be omitted in that family)
Lbl i
Loop (//: Lbl for 84 family)
Input “v=”,v
If v<d Then
Disp “Too Low”
EndIf
If v>d Then
Disp “Too High”
EndIf
If v=3.14 Then
Disp “Game Over”
Goto u
EndIf
If v=d Then
Disp “Next level”
Goto j
EndIf
EndLoop (//:Doesn’t exist in 84. I don’t think it is necessary so can be omitted in that family)
Lbl j
Loop (//: Lbl for 84 family)
Input “w=”,w
If w<e Then
Disp “Too Low”
EndIf
If w>e Then
Disp “Too High”
EndIf
If w=3.14 Then
Disp “Game Over”
Goto u
EndIf
If w=e Then
Disp “Congratulations!”
Goto t
EndIf
EndLoop (//:Doesn’t exist in 84. I don’t think it is necessary so can be omitted in that family)
Lbl u
Disp “Game Over”
Lbl t
Input “Play again?”, s
If s=0 Then
Goto f
EndIf
If s>1 Then
Disp “Error 404”
Disp “Resetting system…”
Disp “Really? Really? You just had to type in something bigger than 1, didn’t you?” (//: Comedic effect. Can be changed for more or less humor, i.e. I have mine call whoever typed in anything greater than one a dumb donkey lol)
Goto t
EndIf
If s=1 Then
Disp “Thanks for playing”
EndIf
EndPrgm