I made a game of tag and as the summary says it runs extremely slow. I would like some help with optimization. I would really love it if you could explain how it works also. I would just like to learn more about it. If you don't want to though that is completely fine. Any help at all would be AWESOME!

I am open to suggestions for the AI also

I may not respond right away just so you know. I will try to get back as soon as I can.

Here is the code:

```
:2→Y:2→X
:7→B:15→A
:0→D:0→S
:0→O:0→T
:Repeat K=45
:ClrHome
:If D=S
:Then
:2→Y:2→X
:7→B:15→A
:D→S
:End
:getKey→K
:Y+(K=34)-(K=25→Y
:X+(K=26)-(K=24→X
:If max(X={0,17
:1+15not(X→X
:If max(Y={0,9
:1+7not(Y→Y
:If max(A={0,17
:1+15not(A→A
:If max(B=0,9
:1+7not(B→B
:Output(Y,X,"θ //Theta
:Output(B,A,"I
:If D=0
:Then
:Y-B→O
:X-A→T
:If B=!Y // I think that is how not equal to is written
:B+1→B
:If B=O
:B→B
:If A=X
:A+1→A
:If A=T
:A→A
:If X<A
:A-2→A
:If Y<B
:B-2→B
:If X=A and Y=B and D=0
:1→D
:End
:If D=1
:Then
:B+randInt(-1,1→B
:A+randInt(-1,1→B
:If X=A and B=Y and D=1
:0→D
:End
:If K=21
:Pause
:End
```