A builder guarding a factory is shown to help it build - #34
Merged
Merged
Conversation
A play-test once said a guarding builder does not assist a factory, and there was no fixture to ask. This is the fixture: a plant with a queue, a builder guarding it, and the frame's progress counted tick by tick. The plant alone pays its two points a tick; with the guard it pays five, finishes in well under half the time, and the guard follows it on to the next unit in the queue rather than standing idle once the first has rolled off. No failing case was found. The yard carries its own storage because the simulation recomputes a player's capacity every second from the units that exist, and a yard with no commander is clamped to nothing otherwise -- which stalls the build and looks, for a moment, exactly like the report. Issue: #22 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22.
What this is. The factory-build harness the issue asks for, in
src/rwe/sim/guardassist.test.cpp: a plant with a build queue, a builder given aGuardOrderon it, ticked with the frame'sbuildTimeCompletedread each tick. Four cases:behaviourStateisBuildingon the plant's frame, and the guard order is still standing afterwards;Verdict on the report. Guard-assist works on the code path the report describes:
handleGuardOrder→buildExistingUnit→deployBuildArm, which starts the guard'sStartBuildingscript like any other build job. No failing case found.Two things worth knowing from writing it.
inBuildStanceby hand on both units, since the empty COB script has noStartBuildingto set it.deployBuildArmdoes issue that thread on the guard route (line 4814), so a real builder gets it from its script.updateResourcesrecomputes a player's storage every second from the units that exist, and a yard with no commander and no storage is clamped to zero on the first second boundary. The plant in the fixture now carries storage and says why. If the original report came from a game with no commander left, that is a candidate explanation for what was seen.Verified.
rwe_test: all 556 test cases pass (71489 assertions), Linux gcc-14 Debug.🤖 Generated with Claude Code
https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun