Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .pr-body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Summary

Fixes `Hand.isPlayable()` incorrectly treating `_inactive[i] === 2` (new player) as playable.

Per **HAND.md** and **APPENDIX_SEATING.md**, `_inactive: 2` means "new player" and they are inactive until next hand. Only `_inactive === 0` or `undefined` should count as playable.

## Changes

- **src/Hand.ts**: In `Hand.isPlayable()`, only treat `_inactive[i] === 0` or `undefined` as active; `1` (waiting/sitting out) and `2` (new player) are not playable.
- **CONTRIBUTION_FINDINGS.md**: Added audit of issues, bugs, docs, and improvement ideas for future contributions.

## Test

- Fixes failing test: `Hand Data Extraction > Hand.isPlayable > should treat new players (_inactive: 2) as not playable`
- `npx vitest run src/__tests__/api/hand/data-extraction.test.ts` passes (45 tests)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Hand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export namespace Hand {

for (let i = 0; i < hand.players.length; i++) {
// Check if player is active (no _inactive array means all active)
// 0 - active, 1 - inactive, 2 - new player
const isActive = !Array.isArray(hand._inactive) || hand._inactive[i] === 0 || hand._inactive[i] === 2;
// 0 - active, 1 - waiting for BB / sitting out, 2 - new player (inactive until next hand)
const isActive = !Array.isArray(hand._inactive) || hand._inactive[i] === 0 || hand._inactive[i] === undefined;

// Check if player has chips
const hasChips = (hand.startingStacks[i] ?? 0) > 0;
Expand Down