Find the work your script repeats

Compare programs from the same starting state to the same completed result. Count movement, repeated observations and rework before changing the algorithm. A shorter-looking script can perform more game actions, and a faster incomplete run is not a valid improvement.

Make the comparison fair

Use a bounded job: for example, observe every cell on the same 4×4 teaching board once. Both candidates must finish all 16 observations, follow the same movement assumptions and end under the same completion rule.

Keep the same initial position and state. If one run begins with half the work marked complete, its result cannot be compared with a fresh run. Check correctness first, including the final target and a failed-action path.

The base game documents a game execution-cost model. Desktop Python speed, source-line count and time spent looking at an editor are different measurements. No DLC timing API or current tick price is assumed here.

Compare fixed hypothetical counts

In the direct route, 15 moves reach 16 cells because the start is already visited. Imagine a second candidate that performs 20 moves by revisiting some locations and makes twice as many observations.

Same result: 16 completed cells Direct46 units 3016 Repeat72 units 4032 Movement (×2) Observation (×1)
Illustrative weights: each move costs 2 units and each observation 1. Both routes complete 16 cells; the longer bar shows extra movement and repeated observation, not measured game ticks.
Illustrative counts for the same completed 16-cell job
WorkDirect routeRepeated work
Successful moves1520
Observations1632
Completed cells1616

If we assign a made-up cost of 2 units per move and 1 per observation, the totals are 15×2 + 16 = 46 and 20×2 + 32 = 72. These weights are only an explanatory model. They are not measured game ticks, a benchmark or a claim of a particular percentage speedup.

The second candidate has five extra moves and sixteen extra observations. Those are concrete places to investigate; fewer source lines alone would not reveal them.

Look for one repeated cost at a time

Movement
Does the route return to an already handled cell without needing to? Draw the positions before changing the movement loop.
Observation
Does one decision read the same unchanged fact repeatedly? Reuse an observation only while the world conditions that made it valid still hold.
Rework
Does a pass reprocess finished targets because completion was not stored correctly? Check state rather than masking it with a larger counter.
Waiting or failure
Does an unchanged failure trigger the same retry forever? A bounded failure branch may be needed before any speed comparison is meaningful.

Do not remove a check merely because it costs something. A check that prevents an invalid action can be essential to correctness.

Test one change against the same result

  1. Save the correct baseline and its starting conditions.
  2. Identify one avoidable action category.
  3. Change that category without changing the job.
  4. Repeat the same case and verify the completed result.
  5. Compare the relevant game measurement or action counts, then keep or reject the change.

If the new version skips a target, changes the intended puzzle result or handles failures differently, fix that difference before calling it faster. More complex strategies, including parallel work, require their own current game contracts and are outside this small comparison.

Sources and further reading