Skip to content

Fix hasWon() always returning false#1

Closed
mmiermans wants to merge 1 commit intomasterfrom
fix/has-won-always-false
Closed

Fix hasWon() always returning false#1
mmiermans wants to merge 1 commit intomasterfrom
fix/has-won-always-false

Conversation

@mmiermans
Copy link
Owner

Summary

  • hasWon() always returned false because return true inside the eachCell callback only exits the callback, not the outer function
  • Also compared the tile object (tile >= 2048) instead of tile.value against 2048

Test plan

  • Verify that winning state (tile >= 2048) is correctly detected

Two bugs: (1) return inside eachCell callback exits the callback,
not the outer function, so hasWon() always returns false.
(2) compares tile object instead of tile.value against 2048.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mmiermans mmiermans closed this Feb 20, 2026
@mmiermans mmiermans deleted the fix/has-won-always-false branch February 20, 2026 20:09
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