# Room & Dimension

## version 1 by Sebastian Rahn

Section 3.3 - Turning around

To turn around:
If Tmp_Direction is north
begin;
If Looking Direction of compass is Face West, Change Looking Direction of compass to Face North;
If Looking Direction of compass is Face East, Change Looking Direction of compass to Face North;
If Looking Direction of compass is Face South
begin;
Change tmp to a random number between 1 and 2;
If tmp is 1, Change Looking Direction of compass to Face West;
If tmp is 2, Change Looking Direction of compass to Face East;
end if;
end if;
If Tmp_Direction is northeast
begin;
If Looking Direction of compass is Face North, stop the action;
If Looking Direction of compass is Face East, stop the action;
If Looking Direction of compass is Face West, Change Looking Direction of compass to Face North;
If Looking Direction of compass is Face South, Change Looking Direction of compass to Face East;
end if;
If Tmp_Direction is northwest
begin;
If Looking Direction of compass is Face North, stop the action;
If Looking Direction of compass is Face West, stop the action;
If Looking Direction of compass is Face East, Change Looking Direction of compass to Face North;
If Looking Direction of compass is Face South, Change Looking Direction of compass to Face West;
end if;
If Tmp_Direction is west
begin;
If Looking Direction of compass is Face North, Change Looking Direction of compass to Face West;
If Looking Direction of compass is Face South, Change Looking Direction of compass to Face West;
If Looking Direction of compass is Face East
begin;
Change tmp to a random number between 1 and 2;
If tmp is 1, Change Looking Direction of compass to Face North;
If tmp is 2, Change Looking Direction of compass to Face South;
end if;
end if;
If Tmp_Direction is east
begin;
If Looking Direction of compass is Face North, Change Looking Direction of compass to Face East;
If Looking Direction of compass is Face South, Change Looking Direction of compass to Face East;
If Looking Direction of compass is Face West
begin;
Change tmp to a random number between 1 and 2;
If tmp is 1, Change Looking Direction of compass to Face North;
If tmp is 2, Change Looking Direction of compass to Face South;
end if;
end if;
If Tmp_Direction is south
begin;
If Looking Direction of compass is Face West, Change Looking Direction of compass to Face South;
If Looking Direction of compass is Face East, Change Looking Direction of compass to Face South;
If Looking Direction of compass is Face North
begin;
Change tmp to a random number between 1 and 2;
If tmp is 1, Change Looking Direction of compass to Face West;
If tmp is 2, Change Looking Direction of compass to Face East;
end if;
end if;
If Tmp_Direction is southeast
begin;
If Looking Direction of compass is Face South, stop the action;
If Looking Direction of compass is Face East, stop the action;
If Looking Direction of compass is Face West, Change Looking Direction of compass to Face South;
If Looking Direction of compass is Face North, Change Looking Direction of compass to Face East;
end if;
If Tmp_Direction is southwest
begin;
If Looking Direction of compass is Face South, stop the action;
If Looking Direction of compass is Face West, stop the action;
If Looking Direction of compass is Face East, Change Looking Direction of compass to Face South;
If Looking Direction of compass is Face North, Change Looking Direction of compass to Face West;
end if.