Robots and Finite-State Machines
by Everett F. Carter, Jr. 

Example 1:
(a)
STATE-MACHINE PROXIMITY
   APPEND-STATE IR_SCAN
   APPEND-STATE LEFT_IR
   APPEND-STATE RIGHT_IR
   APPEND-STATE BOTH_IR
   APPEND-STATE END_IR

(b)
IN-STATE IR_SCAN
   CONDITION BOTH_IR?
   CAUSES PROXIMITY_VEC SET_REVERSE ARBITRATE
   THEN-STATE BOTH_IR
TO-HAPPEN

(c)
MACHINE-CHAIN ROBOT
    SENSORS
    WALKER
    CONTACT
    PROXIMITY
    EXPLORE
END-MACHINE-CHAIN

(d)
  WALK_FORWARD SET-STATE
  IR_SCAN      SET-STATE
  BUMP_SCAN    SET-STATE
  IDLE         SET-STATE
  IDLE_MOTION  SET-STATE


Example 2:
: ARBITRATE
    ( this sequence gives a subsumption behaviour to the system )
    CONTACT_VEC   @ DUP IF EXECUTE EXIT ELSE DROP THEN
    PROXIMITY_VEC @ DUP IF EXECUTE EXIT ELSE DROP THEN
    EXPLORE_VEC   @ DUP IF EXECUTE EXIT ELSE DROP THEN
    WALK_VEC      @ DUP IF EXECUTE EXIT ELSE DROP THEN
;




