Bob Marinier : Soar Utility code

Introduction

This is a set of broadly useful Soar code. It is really intended for use in Michigan style agents. It includes the following:

  • Name a state after the operator that triggered it's creation
  • Put a link to the top-state on every state (especially useful in concurrent goals)
  • Copy operator arguments down to the substate triggered by that operator

 

##!
# @brief Appends the name of the selected operator that triggered us.
# @type state-elaboration
sp {elaborate*state*name
   (state <s> ^superstate.operator.name <name>)
-->
   (<s> ^name <name>)
}

##!
# @brief If we are in any substate then put a link to the top state
# @type state-elaboration
sp {elaborate*state*top-state
   (state <s> ^superstate.top-state <ts>)
-->
   (<s> ^top-state <ts>)
}

##!
# @brief If we are in the top state, then put a top-state link to itself
# @type state-elaboration
sp {elaborate*top-state*top-state
   (state <s> ^superstate nil)
-->
   (<s> ^top-state <s>)
}

#
# Support for treating Michigan style subgoals like functions
#

##!
# @brief
# @type state-elaboration
#
# automatically copy any arguments from the superoperator to the local state
sp {elaborate*state*operator-args-base
   (state <s> ^superstate.operator)
-->
   (<s> ^args <args>)
}

##!
# @brief
# @type state-elaboration
#
# automatically copy any arguments from the superoperator to the local state
sp {elaborate*state*operator-args
   (state <s> ^superstate.operator.<att> <val>
              ^args <args>)
-->
   (<args> ^<att> <val>)
}