in discussion Programming & Design / TI-83/84/+/SE Programming » Coordinate Game
0→E:0→F
Menu("GridHunt, made by Rishi C","Start",1,"How to Play",2,"View Highscores",3,"Exit",Z
Lbl 2
ClrHome
Output(1,1,"Buried treasure has been hidden somewhere in the 150x150 unit grid. Send drones to coordinates to uncover it. They are equipped with magnets that tell you the general distance they are from the treasure using hot, warm, cold, and ice. ->")
0→K:Repeat K≠0:getKey→K:End
ClrHome
Output(1,1,"Click the data button to see previous locations and the possible locations highlighted. Scroll through the guesses with 1 and 2. Press clear to return, and choose (-1,-1) to exit. Have fun!")
0→K:Repeat K≠0:getKey→K:End
Menu("How will you continue?","Play",1,"Tell me again",2,"Exit",Z)
Lbl 1
randInt(1,150)→A
randInt(1,150)→B
AxesOff
GridDot
263→Xmax
1→Xmin
163→Ymax
1→Ymin
{2,50}→dim([G])
Fill(0,[G])
For(T,1,50,1)
Lbl A
ClrDraw
Vertical 152,BLACK
For(C,151,163,2)
Horizontal C,NAVY
End
TextColor(RED)
Text(0,28,"View Guesses")
For(C,153,263,2)
Vertical C,WHITE
End
Text(140,200,"Try #"+toString(T)
Text(150,13,""
Input
If Y<1 and X<1:Goto Z
If Y<1 or X>150 or X<1 or (Y>150 and T<2)
Then
ClrHome
Disp "Choose a valid point","Points must have positive","coordinates less than 151","Choose a point with y>150","and >0 tries","to view past guesses"
Wait 5
Goto A
End
If Y>150 and X<151 and T>1
Then
1→G
Repeat K=45
ClrDraw
Vertical 152,BLACK
For(C,151,163,2)
Horizontal C,NAVY
End
TextColor(RED)
Text(0,26,"Clear to Exit")
For(C,153,263,2)
Vertical C,WHITE
End
Text(140,160,"Viewing try #"+toString(G)
[G](1,G)→M
[G](2,G)→N
√(abs(M-A)^2+abs(N-B)^2)→D
If D≤10
Then
Text(5,200,"HOT!"
2→S
For(R,0,10,S)
For(θ,0,2π,0.05)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,RED)
If K=0:getKey→K:If K=26:Then:9→R:0→θ:End:If K=45:Goto A
End
End
End
If D>10 and D≤20
Then
Text(5,200,"Warm"
2.5→S
For(R,10,20,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,ORANGE)
If K=0:getKey→K:If K=26:Then:19→R:0→θ:End:If K=45:Goto A
End
End
End
If D>20 and D≤50
Then
Text(5,200,"Cold"
2→S
For(R,20,50,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,BLUE)
If K=0:getKey→K:If K=26:Then:49→R:0→θ:End:If K=45:Goto A
End
End
End
If D>50
Then
Text(5,200,"Ice..."
6→S
For(R,50,211,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,LTBLUE)
If K=0:getKey→K:If K=26:Then:210→R:0→θ:End:If K=45:Goto A
End
End
End
Repeat K=92 or K=93 or K=45:getKey→K:End
If K=92 and G>1:G-1→G
If K=93 and G<T-1:G+1→G
End
End
If E≠0:Then:0→E:0→F:Goto A:End
X→[G](1,T)
Y→[G](2,T)
0→K
Pt-On(X,Y,2,GREEN)
√(abs(X-A)^2+abs(Y-B)^2)→D
If D≤10
Then
Text(5,200,"HOT!"
2→S
For(R,0,10,S)
For(θ,0,2π,0.05)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,RED)
If K=0:getKey→K:If K=26:9→R
End
End
End
If D>10 and D≤20
Then
Text(5,200,"Warm"
3→S
For(R,10,20,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,ORANGE)
If K=0:getKey→K:If K=26:19→R
End
End
End
If D>20 and D≤50
Then
Text(5,200,"Cold"
2→S
For(R,20,50,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,BLUE)
If K=0:getKey→K:If K=26:49→R
End
End
End
If D>50
Then
Text(5,200,"Ice..."
6→S
For(R,50,211,S)
For(θ,0,2π,0.1)
getKey→K
X+(R)*cos(θ)→E
Y+(R)*sin(θ)→F
If K=0:getKey→K
If E≥0 and E≤150 and F≥0 and F≤150:Pt-On(E,F,LTBLUE)
If K=0:getKey→K:If K=26:210→R
End
End
End
0→K:Repeat K≠0:getKey→K:End
If K=45:Goto Z
End
Lbl Z
ClrDraw
Disp "Bye!