Skip to content

Commit

Permalink
Fix incorrect command args
Browse files Browse the repository at this point in the history
`--timetags`, etc. require two dashes, not one.

Fix incorrectly escaped asterisks where noticed; I actually think this needs
another pass to put all rule names into backticks, but I don't know if all rule
names have an asterisk, so I didn't bother this time. See #13 for follow-up.
  • Loading branch information
garfieldnate committed Jan 14, 2025
1 parent 2cd6043 commit 25f7cee
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions docs/tutorials/soar_tutorial/02.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ rules fire and retract in parallel until quiescence.
When running your new eater, it will go north until it hits a wall or
the border. When it can no longer move, it will start generating states
because it cannot successfully apply and terminate the move-north
operator. Below is a sample trace, with the watch 3 --timetags in use,
operator. Below is a sample trace, with the `watch 3 --timetags` in use,
of the interaction window for the first two moves to the north by an
eater.

Expand Down Expand Up @@ -707,12 +707,12 @@ Here is one possible set of rules for the move-to-food operator.

```
# Move-to-food operator
# Propose*move-to-food\*normalfood
# Propose*move-to-food*normalfood
# If there is normalfood in an adjacent cell,
# propose move-to-food in the direction of that cell
# and indicate that this operator can be selected randomly.
#
# Propose*move-to-food\*bonusfood
# Propose*move-to-food*bonusfood
# If there is bonusfood in an adjacent cell,
# propose move-to-food in the direction of that cell
# and indicate that this operator can be selected randomly.
Expand All @@ -721,7 +721,7 @@ Here is one possible set of rules for the move-to-food operator.
# If the move-to-food operator for a direction is selected,
# generate an output command to move in that direction.
#
# Apply*move-to-food\*remove-move:
# Apply*move-to-food*remove-move:
# If the move-to-food operator is selected,
# and there is a completed move command on the output link,
# then remove that command.
Expand Down Expand Up @@ -844,7 +844,7 @@ The final rule removes the move command from the output-link when it has
completed.

```Soar
sp {apply*move-to-food\*remove-move
sp {apply*move-to-food*remove-move
(state <s> ^io.output-link <out>
^operator.name move-to-food)
(<out> ^move <move>)
Expand Down Expand Up @@ -1149,11 +1149,11 @@ about to fire.

```
red> matches propose*move-to-food
1 (state <s> ^io <i\*1>)
1 (<i\*1> ^input-link <i\*2>)
1 (<i\*2> ^my-location <m\*1>)
7 (<m\*1> ^<dir> <d\*1>)
3 (<d\*1> ^content { << normalfood bonusfood >> <c\*1> })
1 (state <s> ^io <i*1>)
1 (<i*1> ^input-link <i*2>)
1 (<i*2> ^my-location <m*1>)
7 (<m*1> ^<dir> <d*1>)
3 (<d*1> ^content { << normalfood bonusfood >> <c*1> })
3 complete matches.
```

Expand All @@ -1164,21 +1164,21 @@ condition then restricts the matches to be only those that have content
normalfood or bonusfood.

If a rule does not completely match, the condition that failed to match
will be preceded by >>>> as in:
will be preceded by `>>>>` as in:

```
red> matches apply*move-to-food\*remove-move
1 (state <s> ^operator <o\*1>)
1 (<o\*1> ^name move-to-food)
1 (<s> ^io <i\*1>)
1 (<i\*1> ^output-link <out>)
red> matches apply*move-to-food*remove-move
1 (state <s> ^operator <o*1>)
1 (<o*1> ^name move-to-food)
1 (<s> ^io <i*1>)
1 (<i*1> ^output-link <out>)
1 (<out> ^move <move>)
>>>> (<move> ^status complete)
0 complete matches.
```

Matches can also print out working memory elements that match the
conditions by using the -timetags (for just the timetags) or –wmes (for
conditions by using the `--timetags` (for just the timetags) or `-–wmes` (for
complete working memory elements) arguments. Matches can be invoked by
clicking with the right mouse button on the name of a production and
then selecting “production” from the menu that appears.
Expand Down Expand Up @@ -1211,9 +1211,9 @@ This example shows that there are three operators proposed (O7, O8, O9),
and each one has an acceptable and indifferent preference.

The preferences command has another feature that makes it extremely
useful. Using the -name argument, it will tell you the name of the
useful. Using the `--name` argument, it will tell you the name of the
production that created the preference. For example, if you want to
discover why there is the working memory element (I3 move m3), you can
discover why there is the working memory element `(I3 move m3)`, you can
type:

```
Expand All @@ -1224,9 +1224,9 @@ M3 +
From apply*move-to-food
```

This tells you that apply*move-to-food creates this working memory
This tells you that apply\*move-to-food creates this working memory
element. If you want to find out what working memory elements matched
apply*move-to-food when it created (I3 move m3), you can type:
apply*move-to-food when it created `(I3 move m3)`, you can type:

```
red> preferences I3 move --wmes
Expand Down Expand Up @@ -1275,7 +1275,7 @@ click on the step button and see what happens. You should get a trace
like:

```
red> \*\*\*
red> ***
0: ==>S: S1
1: ==>S: S2 (state no-change)
```
Expand All @@ -1285,11 +1285,11 @@ out why, try matches propose*move-to-food.

```
red> matches propose*move-to-food
1 (state <s> ^io <i\*1>)
1 (<i\*1> ^input-link <i\*2>)
1 (<i\*2> ^my-location <m\*1>)
7 (<m\*1> ^<dir> <d\*1>)
>>>> (<d\*1> ^contant { << normalfood bonusfood >> <c\*1> })
1 (state <s> ^io <i*1>)
1 (<i*1> ^input-link <i*2>)
1 (<i*2> ^my-location <m*1>)
7 (<m*1> ^<dir> <d*1>)
>>>> (<d*1> ^contant { << normalfood bonusfood >> <c*1> })
0 complete matches.
```

Expand All @@ -1305,7 +1305,7 @@ going one step again. You should have the following in your interaction
window:

```
red> \*\*\*
red> ***
0: ==>S: S1
1: O: O1 (move-to-food)
```
Expand Down Expand Up @@ -1412,7 +1412,7 @@ contents except walls. This rule will have to be changed if we ever add
other types of food (e.g., superbonusfood). It might be better to write
a rule that tests that the content is _not equal_ to wall. This can be
done in Soar by using “<>”. The not equal test can also be combined
with the variable as in propose*move*1a, giving the following rule:
with the variable as in propose\*move\*1a, giving the following rule:

```Soar
sp {propose*move*2a
Expand Down Expand Up @@ -1631,7 +1631,7 @@ is better than it.
You could have used a best preference for a move into a cell with
normalfood instead of using the worst preference. The move to normalfood
would then be selected over a move to an empty cell or a cell with an
eater. Select*move*bonusfood-better-than-normalfood-empty-eater will
eater. Select\*move\*bonusfood-better-than-normalfood-empty-eater will
ensure that bonusfood is preferred to normalfood.

```Soar
Expand Down Expand Up @@ -1708,7 +1708,7 @@ parallel, with operator proposals following selections.

![](Images/02/image27.png)

## Advanced Move Operator\*\*
## Advanced Move Operator

The eater you created in the last section will greedily consume food and
never get stuck. However, its behavior doesn’t always appear to be very
Expand Down Expand Up @@ -1796,11 +1796,11 @@ the initial situation when there is no existing last-direction.) Try to
write the English and Soar versions of these two rules.

```Soar
# Apply*move*create\*last-direction
# Apply*move*create*last-direction
# If the move operator for a direction is selected,
# create an augmentation called last-direction with that direction.
sp {apply*move*create\*last-direction
sp {apply*move*create*last-direction
(state <s> ^operator <o>)
(<o> ^name move
^direction <direction>)
Expand All @@ -1814,7 +1814,7 @@ sp {apply*move*create\*last-direction
# and the last-direction is not equal to that direction,
# then remove the last-direction.
sp {apply*move*remove\*last-direction
sp {apply*move*remove*last-direction
(state <s> ^operator <o>
^last-direction <direction>)
(<o> ^direction <> <direction>
Expand Down Expand Up @@ -1844,7 +1844,7 @@ persist throughout the life of the eater, you can use a rule that tests
that the state exists and then creates the structure in working memory
in the action. Whenever the structure must change during the life of the
eater, you must use a pair of rules that are part of the application of
an operator - one to add the structure when appropriate, and one to
an operator -- one to add the structure when appropriate, and one to
remove the structure when it is no longer appropriate.

### Advanced Move Operator Proposal
Expand Down Expand Up @@ -2094,21 +2094,21 @@ output-link without risk of copying other augmentations. Under that
convention, the general command creation rule is:

```Soar
sp {apply\*operator\*create-action-command
sp {apply*operator*create-action-command
(state <s> ^operator.actions.<att> <value>
^io.output-link <out>)
-->
(<out> ^<att> <value>)}
```

The <att> variable will match jump and the value will match the
The `<att>` variable will match jump and the value will match the
identifier of the object that has direction as an augmentation. It
copies ^jump and that identifier on to the output-link.

The second general rule removes a completed action command.

```Soar
sp {apply\*operator\*remove-command
sp {apply*operator*remove-command
(state <s> ^operator.actions
^io.output-link <out>)
(<out> ^<att> <value>)
Expand All @@ -2124,7 +2124,7 @@ you need to modify the proposal rules so that they create the actions
structure. Below is an example of the jump operator proposal.

```Soar
sp {propose\*jump
sp {propose*jump
(state <s> ^io.input-link.my-location.<dir>.<dir>.content
{ <content> <> wall })
-->
Expand Down Expand Up @@ -2166,7 +2166,7 @@ sp {select*move*bonusfood-better-than-normalfood-empty-eater
```

```Soar
sp {select\*jump\*bonusfood-better-than*move*empty
sp {select*jump*bonusfood-better-than*move*empty
(state <s> ^operator <o1> +
^operator <o2> +)
(<o1> ^name jump
Expand Down Expand Up @@ -2219,7 +2219,7 @@ matches each operator and the appropriate name-content-value and copies
the value onto the operator.

```Soar
sp {elaborate\*operator\*value
sp {elaborate*operator*value
(state <s> ^operator <o> +
^name-content-value <ccv>)
(<o> ^name <name> ^content <content>)
Expand All @@ -2233,7 +2233,7 @@ operator and then creates a better preference for the operators with
higher values.

```Soar
sp {select\*compare\*best\*value
sp {select*compare*best*value
(state <s> ^operator <o1> +
^operator <o2> +)
(<o1> ^value <v>)
Expand Down

0 comments on commit 25f7cee

Please sign in to comment.