Following the order of operations, it is evaluated like this:

(K=24 ; This evaluates to either 1 (True) or 0 (False) depending on the value of K

(K=26); This also is either a 1 or 0, depending on the value in K.

Therefore X+(K=26)-(K=24 is best represented by X+[-1,0,1]. This means X plus one of the numbers in the set will be the result. The next command is the min command. This will take the lowest value of the array it is evaluating. By doing min(26,X it is defining the Upper bound of 26. If X is ever greater than 26, the Min command will return 26. If X is lower than 26, it will return X. The max command sets the lower bound. By using max(1,Y it is ensured the result will always be greater than or equal to 1. If Y is greater than 1, Y will be the result. Otherwise, if Y is smaller than 1 the result of the statement will be 1.

By stringing all the parts together, it removes the need for If statements to check for the bounds of the screen.

]]>Replace the current code with:

`ClrHome 8→X 4→Y Repeat max(K={45,21,105 ;Checks to see if Clear, Enter, or 2nd is used Output(Y,X,"O Repeat K getKey→K End Output(Y,X," ;One space, this saves several bytes because there are no ClrHome commands after and in every single If max(1,min(26,X+(K=26)-(K=24→X max(1,min(16,Y+(K=34)-(K=25→Y End ;Replaces all those other End statements`

8→X

4→Y

Output(X,Y,"0

getKey→A

While 1

If A=25

Then

X-1→X

ClrHome

If X=1

Then 2→X

If A=34

Then

X+1→X

If X+8

ClrHome

Then

7→X

If A=24

Then

Y-1→Y

ClrHome

If Y=1

Then

2→Y

If A=26

Then

Y+1→Y

ClrHome

If Y=16

Then

15→Y

End

End

End

End

End

End

End

End

End