Fix: price horizontal water moves at the water cost#11
Open
XaXayo12 wants to merge 1 commit into
Open
Conversation
…+ flat add) Review catch (chatgpt-codex): Forward/Diagonal seeded the move with travelCost() at land speed and then added a flat liquidCost. With sprinting on (the default) a one-block water move came to ~8.02 ticks instead of the 9.09 water cost, and the flat add did not scale, so diagonal water moves were undercharged even more. Paths could prefer water because it was priced too cheaply. travelCost(blocks, inLiquid) now returns WALK_ONE_IN_WATER_COST * blocks when in liquid (you swim, can't sprint/walk), which is correct and scales with distance. Forward and Diagonal pass inLiquid and no longer add the flat liquidCost. The vertical providers (jump/drop/up/down) are unchanged.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Addresses the chatgpt-codex review note on #8.
Bug: Forward/Diagonal seeded the move with
travelCost()at land speed and then added a flatliquidCost(defaultWATER - WALK). With sprinting on (the default), a one-block water move came toSPRINT + (WATER-WALK)≈ 8.02t instead of the intended 9.09t, and the flat add doesn't scale, so diagonal water moves were undercharged more. A* could then prefer water because it was priced too cheaply.Fix:
travelCost(blocks, inLiquid)returnsWALK_ONE_IN_WATER_COST * blockswhen in liquid (you swim — no sprint/walk), which is correct and scales with distance. Forward and Diagonal passinLiquidand drop the flat add. Vertical providers (jump/drop/up/down) are unchanged.Now a 1-block water move costs exactly
WALK_ONE_IN_WATER_COST(9.091), and a diagonalWALK_ONE_IN_WATER_COST * √2.Verified:
npm run build+npx ts-standard -yclean,npm test31/31.