Skip to content

Unify winner detection implementation into shared package#2

Open
Pfarrer wants to merge 1 commit intomainfrom
feature/unify-winner-detection
Open

Unify winner detection implementation into shared package#2
Pfarrer wants to merge 1 commit intomainfrom
feature/unify-winner-detection

Conversation

@Pfarrer
Copy link
Owner

@Pfarrer Pfarrer commented Oct 15, 2025

Summary

  • Unified three separate winner detection implementations into a single shared function in the shared package
  • Updated hasWinner to return BoardCell instead of PlayerType for better reusability
  • Added findWinningCells function to return winning cell indices
  • Updated app package to use shared hasWinner function
  • Updated server package with proper board format conversion
  • Enhanced test coverage for both functions with 21 passing tests
  • Fixed TypeScript errors in minimax and hasWinner functions

Test plan

  • All shared package tests passing (21 tests)
  • TypeScript compilation successful for all packages
  • Code formatting and linting passes
  • Board format conversion works correctly in server package
  • Minimax algorithm updated to work with new BoardCell return type

💘 Generated with Crush

- Refactored three separate winner detection implementations into single shared function
- Updated hasWinner to return BoardCell instead of PlayerType for better reusability
- Added findWinningCells function to return winning cell indices
- Updated app package to use shared hasWinner function
- Updated server package with proper board format conversion
- Enhanced test coverage for both functions
- All shared tests passing
- Fixed TypeScript errors in minimax and hasWinner functions

Co-authored-by: Brian Pfretzschner <brianp.de@gmail.com>
💘 Generated with Crush
@Pfarrer Pfarrer force-pushed the feature/unify-winner-detection branch from 041800e to 5f83b03 Compare October 17, 2025 19:36
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