In addition to jonbush's method, you could also use boolean logic (which is also described on the movement page).

` ``ClrHome 5->A 8->B Repeat K=105 getKey->K If Ans Output(A,B," " //one space A+(K=34)(A<8)-(K=25)(A>1->A B+(K=26)(B<16)-(K=24)(B>1->B Output(A,B,"0`

However, if you still want to use your program, ou need to redefine the variables before using them. Here's how it would look:

` ``ClrHome Output(5,8,"0 A=5 B=8 Lbl 1 Disp "DIRECTION ?" Prompt D ClrHome If D=4 B-1->B If D=8 A-1->A If D=6 B+1->B If D=2 A+1->A Output(A,B,"0 Goto 1`

Hope this helps :) ]]>

` ``ClrHome 5→A 8→B Repeat K=45 Output(A,B,0 Repeat Ans getKey→K End Output(A,B," " min(8,max(1,A+sum(ΔList(Ans={73,93→A min(16,max(1,B+sum(ΔList(K={82,84→B End`

It might help to look at the Movement page.

]]>:Output(5,8,"0

:A=5

:B=8

:Lbl 1

:Disp "DIRECTION ?"

:Prompt D

:ClrHome

:If D=4

:Output(A,B-1,"0

:If D=8

:Output(A-1,B,"0

:If D=6

:Output(A,B+1,"0

:If D=2

:Output(A+1,B,"0

:Output(A,B,"0

:Goto 1

So you see the idea is to put in variables for A and B, which are the coordinates for the "0". To get new coordinates, a number is plugged in. If it was "6", that means go right. So we add 1 to the B and it makes it go right. Now we have new variables and we display the "0" with the new coordinates.

Any help would be greatly appreciated. Here to answer questions. If possible, I'd like to keep the same format of code using prompts for new numbers and using numbers as arrow keys, etc.

]]>