fix watch wakeup test (#1791)

This improves the test introduced in #1736 in a few ways:
* Place the system robot's code inline in the `program` field
    * even though the system bot had been using `instant`, the `run` command itself incurs a delay.  So this ensures the system robot is ready to monitor the cell immediately
* System robot uses exclusively `Intangible` commands in its monitoring loop
    * This allows removal of the `instant` command.
    * `Surveil`, which does not appear in any scenario yet, is made `Intangible`.
* Remove the initial `wait 2` in the player robot's solution.

Tested to ensure that this still exercises the problem that #1736 set out to solve, by commenting out this line (causing the scenario to fail).

01ae0e45d7/src/swarm-engine/Swarm/Game/State/Robot.hs (L396)

## Demo

    scripts/play.sh -i data/scenarios/Testing/1598-detect-entity-change.yaml --autoplay --speed 1
This commit is contained in:
Karl Ostmo 2024-03-15 07:34:26 -07:00 committed by GitHub
parent 01ae0e45d7
commit 02eecba832
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 22 deletions

View File

@ -50,11 +50,26 @@ robots:
invisible: true
dir: [1, 0]
program: |
run "scenarios/Testing/_1598-detect-entity-change/setup.sw"
def doUntilCorrect =
herenow <- ishere "dial (G)";
if herenow {
give base "flower";
} {
loc <- whereami;
surveil loc;
wait 1000;
doUntilCorrect;
}
end;
def go =
doUntilCorrect;
end;
go;
inventory:
- [1, flower]
solution: |
wait 2;
move;
move;
swap "dial (G)";

View File

@ -1,17 +0,0 @@
def doUntilCorrect =
herenow <- ishere "dial (G)";
if herenow {
give base "flower";
} {
watch down;
wait 1000;
doUntilCorrect;
}
end;
def go =
instant $
doUntilCorrect;
end;
go;

View File

@ -827,9 +827,13 @@ constInfo c = case c of
, "Any change to entities at the monitored locations will cause the robot to wake up before the `wait` timeout."
]
Surveil ->
command 1 short . doc (Set.singleton $ Query $ Sensing EntitySensing) "Interrupt `wait` upon (remote) location changes." $
[ "Like `watch`, but with no restriction on distance."
]
command 1 Intangible $
doc
(Set.singleton $ Query $ Sensing EntitySensing)
"Interrupt `wait` upon (remote) location changes."
[ "Like `watch`, but instantaneous and with no restriction on distance."
, "Supply absolute coordinates."
]
Heading -> command 0 Intangible $ shortDoc (Set.singleton $ Query $ Sensing RobotSensing) "Get the current heading."
Blocked -> command 0 Intangible $ shortDoc (Set.singleton $ Query $ Sensing EntitySensing) "See if the robot can move forward."
Scan ->