# AI Moving

## version 1 by Sebastian Rahn

**Section 1 - Chasing Phrases****Section 1.1 - Simple Chase**

Follow_Stop is a truth state that varies.

Follow_Done is a truth state that varies.

Follow_Number_Goal is a number that varies.

Follow_Number_Runner is a number that varies.

To start a simple chase:

If Follow_Stop is true, change Follow_Stop to false;

If Follow_Done is true, change Follow_Done to false;

If Show Map is true

begin;

change Compass to Follow_Goal;

calculate coordinates;

change Compass to Follow_Runner;

calculate coordinates;

choose row with Letters28 of Y-Axis of Follow_Goal in Table 200;

change Follow_Number_Goal to Number Entry;

choose row with Letters28 of Y-Axis of Follow_Runner in Table 200;

change Follow_Number_Runner to Number Entry;

If Follow_Number_Goal is Follow_Number_Runner

begin;

If X-Axis of Follow_Goal is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal + 1) < X-Axis of Follow_Runner, change tmp_Direction to north;

If (X-Axis of Follow_Goal + 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal - 1) > X-Axis of Follow_Runner, change tmp_Direction to south;

If (X-Axis of Follow_Goal - 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

change Follow_Done to true;

otherwise;

If Follow_Number_Goal > (Follow_Number_Runner + 1)

begin;

If X-Axis of Follow_Goal is X-Axis of Follow_Runner, change tmp_Direction to east;

If X-Axis of Follow_Goal < X-Axis of Follow_Runner, change tmp_Direction to northeast;

If X-Axis of Follow_Goal > X-Axis of Follow_Runner, change tmp_Direction to southeast;

change Follow_Done to true;

end if;

If (Follow_Number_Goal - 1) is Follow_Number_Runner

begin;

If X-Axis of Follow_Goal is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal + 1) < X-Axis of Follow_Runner, change tmp_Direction to north;

If (X-Axis of Follow_Goal + 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal - 1) > X-Axis of Follow_Runner, change tmp_Direction to south;

If (X-Axis of Follow_Goal - 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

change Follow_Done to true;

end if;

If (Follow_Number_Goal + 1) is Follow_Number_Runner

begin;

If X-Axis of Follow_Goal is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal + 1) < X-Axis of Follow_Runner, change tmp_Direction to north;

If (X-Axis of Follow_Goal + 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

If (X-Axis of Follow_Goal - 1) > X-Axis of Follow_Runner, change tmp_Direction to south;

If (X-Axis of Follow_Goal - 1) is X-Axis of Follow_Runner, change Follow_Stop to true;

change Follow_Done to true;

end if;

If Follow_Done is false

begin;

If X-Axis of Follow_Goal is X-Axis of Follow_Runner, change tmp_Direction to west;

If X-Axis of Follow_Goal < X-Axis of Follow_Runner, change tmp_Direction to northwest;

If X-Axis of Follow_Goal > X-Axis of Follow_Runner, change tmp_Direction to southwest;

end if;

end if;

end if;