I'm wondering how I can make my snake to be a certain length.
I now have an infinite snake which keeps growing.
This is my code and I also have a domain error in it, which came when I added the box:
Code:
and the error is on this line:
Code:
This is the whole code.
Code:
I now have an infinite snake which keeps growing.
This is my code and I also have a domain error in it, which came when I added the box:
Code:
For(D,0,94)
Pxl-On(0,D)
Pxl-On(62,D)
For(E,0,62)
Pxl-On(E,0)
Pxl-On(E,94)
and the error is on this line:
Code:
If pxl-Test(Y,X)
This is the whole code.
Code:
ClrDraw
AxesOff
0→Xmin
0→Ymin
62→Ymax
94→Xmax
47→X
10→Y
1→D
1→A
0→B
0→C
For(D,0,94)
Pxl-On(0,D)
Pxl-On(62,D)
For(E,0,62)
Pxl-On(E,0)
Pxl-On(E,94)
While 1
If A=0
Then
Disp B
Stop
End
If C=0
Then
randInt(1,93)→S
randInt(1,61)→T
1→C
End
Pxl-On(T,S)
Pxl-On(Y,X)
getKey→K
If K=25
Then
If D≠2
Then
0→D
End
End
If K=26
Then
If D≠3
Then
1→D
End
End
If K=34
Then
If D≠0
Then
2→D
End
End
If K=24
Then
If D≠1
Then
3→D
End
End
If D=0
Then
Y-1→Y
End
If D=1
Then
X+1→X
End
If D=2
Then
Y+1→Y
End
If D=3
Then
X-1→X
End
If S=X and T=Y
Then
B+1→B
0→C
Else
If pxl-Test(Y,X)
Then
0→A
End
End
End