Skip to content

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Mar 11, 2024

Addresses #1736 (comment).

Testing procedure

First I tried using the debugger to step through the 1598-detect-entity-change.yaml test added in #1736, without applying the changes of this PR.
This was done by invoking it with:

scripts/play.sh -i data/scenarios/Testing/1598-detect-entity-change.yaml

then:

  1. pausing (CTRL+p)
  2. Inputting the solution contents to the REPL in one line: move; move; swap "dial (G)"; swap "dial (B)";
  3. Using Meta+d to start the debugger
  4. Repeatedly using CTRL+o to step through with the debugger.

As it turns out, debugging mode for this particular scenario and solution was unbroken by #1736. A more specific test case would have to be engineered to exercise the particular gap introduced by #1736.

Since I couldn't find any existing unit/integration tests for the debugger, I have left this for a future exercise. However, based on the assumed behavior discrepancy between normal mode and debug mode, I did make a change to the singleStep function.

Implementation notes

I had to augment the runRobotIDs/iterateRobots functions to accommodate the debugger by supporting interruption of the iteration at a certain RID and returning the RIDs that hadn't been visited yet.

In singleStep, the runRobotIDs function is called from within the SBefore case, the SAfter case, and the SSingle case. In the SAfter and SSingle instance, runRobotIDs is just used to run "the rest of the robots", so no special behavior is needed. In this PR, the behavior has been extracted to a new finishTickWith function.

SBefore case

This calls runRobotIDs preFoc immediately. This is the only place that necessitated support for "early interruption" of the iteration of iterateRobots.

SAfter case

TODO

SSingle case

TODO

Handling stepRobot invoked from SSingle

TODO

@kostmo kostmo force-pushed the bugfix/debugger-robot-runpool branch from 11de093 to 4d34296 Compare March 11, 2024 02:50
@kostmo kostmo changed the title debugger robot runpool [WIP] debugger robot runpool Mar 11, 2024
@kostmo kostmo force-pushed the bugfix/debugger-robot-runpool branch from 8b3cb93 to 219727e Compare March 12, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant