############################################################################
# From Chapter 10 of Soar 8 Tutorial
# 
# These are the final versions of the rules for the jump operator.
# These can be loaded in with the advanced move operator 

sp {initialize*state*directions
   (state <ss> ^type state)
   -->
   (<ss> ^directions <n>   
         ^directions <e>   
         ^directions <s>   
         ^directions <w>)
   (<n> ^value north ^opposite south)
   (<e> ^value east  ^opposite west)
   (<s> ^value south ^opposite north)
   (<w> ^value west  ^opposite east)}

# Propose*jump:
# If the content of a cell two steps away in a direction is not a wall, 
#    propose jump in the direction of that cell, with the cell's content,
#    and indicate that this operator can be selected randomly.

sp {propose*jump
   (state <s> ^io.input-link.my-location.<dir>.<dir>.content 
       { <content> <> wall })
-->
   (<s> ^operator <o> +, =)
   (<o> ^name jump
        ^direction <dir>
        ^content <content>)} 

# Apply*move*jump
# If the move or jump operator for a direction is selected,
#    generate an output name to move in that direction.

sp {apply*move
   (state <s> ^io.output-link <ol>
              ^operator <o>)
   (<o> ^name { <name> << move jump >> }
        ^direction <dir>)
-->
   (<ol> ^<name>.direction <dir>)}  

# Apply*move*jump*remove-name:
# If the move or jump operator is selected,
#    and there is a completed name on the output link,
#    then remove that name.

sp {apply*move*remove-move
   (state <s> ^io.output-link <ol>
              ^operator.name <name>)
   (<ol> ^<name> <direction>)
   (<direction> ^status complete)
-->
   (<ol> ^<name> <direction> -)}
