Room & Dimension
version 1 by Sebastian Rahn
Section 1.3 - Decide above/below/left/right/etc
To decide whether (Searched - a thing) is above of (Detective - a thing):
If location of Searched is location of Detective
begin;
If X-Axis of Searched < X-Axis of Detective, decide yes;
end if;
decide no.
To decide whether (Searched - a thing) is below of (Detective - a thing):
If location of Searched is location of Detective
begin;
If X-Axis of Searched > X-Axis of Detective, decide yes;
end if;
decide no.
To decide whether (Searched - a thing) is neighbour of (Detective - a thing):
If location of Searched is location of Detective
begin;
If X-Axis of Searched is X-Axis of Detective, decide yes;
end if;
decide no.
To decide whether (Searched - a thing) is indirect neighbour of (Detective - a thing):
If location of Searched is location of Detective
begin;
If X-Axis of Searched is X-Axis of Detective, decide yes;
If (X-Axis of Searched + 1) is X-Axis of Detective, decide yes;
If (X-Axis of Searched - 1) is X-Axis of Detective, decide yes;
end if;
decide no.
To decide whether (Searched - a thing) is left of (Detective - a thing):
If Y-Axis of Detective is "LE", decide no;
If location of Searched is location of Detective
begin;
choose row with Letters28 of Y-Axis of Detective in Table 200;
Change tmp to Number Entry;
choose row with Letters28 of Y-Axis of Searched in Table 200;
If tmp > Number Entry
begin;
decide yes;
otherwise;
decide no;
end if;
end if;
decide no.
To decide whether (Searched - a thing) is on a sector left of (Detective - a thing):
If Y-Axis of Detective is "LE", decide no;
If location of Searched is location of Detective
begin;
choose row with Letters28 of Y-Axis of Detective in Table 200;
Change tmp to Number Entry;
choose row with Letters28 of Y-Axis of Searched in Table 200;
If (tmp - 1) is Number Entry
begin;
decide yes;
otherwise;
decide no;
end if;
end if;
decide no.
To decide whether (Searched - a thing) is right of (Detective - a thing):
If Y-Axis of Detective is "RE", decide no;
If location of Searched is location of Detective
begin;
choose row with Letters28 of Y-Axis of Detective in Table 200;
Change tmp to Number Entry;
choose row with Letters28 of Y-Axis of Searched in Table 200;
If tmp < Number Entry
begin;
decide yes;
otherwise;
decide no;
end if;
end if;
decide no.
To decide whether (Searched - a thing) is on a sector right of (Detective - a thing):
If location of Searched is location of Detective
begin;
choose row with Letters28 of Y-Axis of Detective in Table 200;
Change tmp to Number Entry;
choose row with Letters28 of Y-Axis of Searched in Table 200;
If (tmp + 1) is Number Entry
begin;
decide yes;
otherwise;
decide no;
end if;
end if;
decide no.
To decide whether (Searched - a thing) is straight of (Detective - a thing):
If location of Searched is location of Detective
begin;
choose row with Letters28 of Y-Axis of Detective in Table 200;
Change tmp to Number Entry;
choose row with Letters28 of Y-Axis of Searched in Table 200;
If tmp is Number Entry
begin;
decide yes;
otherwise;
decide no;
end if;
end if;
decide no.