Commit d271a7a
authored
Fix incorrect condition in "Chains of computations" example (#8109)
Fixes #8097
The refactored example in the "Chains of computations" section uses
an incorrect condition that changes the game logic from the original.
The original Effect-based code advances the round after 4 gold cards:
- Increments first (0→1, 1→2, 2→3, 3→4)
- Then checks `goldCardCount > 3` (true when count is 4)
The refactored code with `goldCardCount <= 3` allows 5 gold cards:
- Checks before incrementing
- Allows counts 0, 1, 2, 3 to increment (4 values)
- Advances on the 5th card (when count is 4)
This fix changes the condition to `goldCardCount < 3`:
- Allows counts 0, 1, 2 to increment (3 values)
- Advances on the 4th card (when count is 3)
- Matches the original behavior
Verified by tracing execution logic and building the docs site locally.
Co-authored-by: PaulyBearCoding <PaulyBearCoding@users.noreply.github.com>1 parent 6a70889 commit d271a7a
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| |||
0 commit comments