hacksu / hacksu/bingo

Multiple free-space tiles can render an incomplete card

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Problem

The admin UI permits multiple `isFreeSpace` tiles. `effectivePoolSize` subtracts every free space after the first, but `getCardSize` still returns the minimum size of 5. `pickCardWithFreeSpace` then drops all but one free-space tile and can return fewer than 25 cells. `tooFewTiles` uses the raw tile count, so it does not prevent rendering.

## Reproduction

1. Create a 25-tile pool with two tiles marked Free.
2. Open `/bingo`.

The effective pool is 24, the selected card has 23 regular tiles plus one centered free space (24 total), and the UI renders only 24 cells in a 5-column grid. The core calculation reproduces as `{ effectivePoolSize: 24, cardSize: 5, renderedTiles: 24 }`.

## Suggested fix

Validate or enforce exactly zero or one free-space tile, or base the availability check on the effective pool and require `cardSize ** 2` selected tiles before showing the board. The tile admin should prevent the invalid configuration or clearly normalize extra free spaces.

## Affected code

- `src/lib/bingo.ts`
- `src/lib/server/cardShuffle.ts`
- `src/routes/bingo/+page.server.ts`
- `src/routes/admin/tiles/+page.server.ts`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the effectivePoolSize, getCardSize, and pickCardWithFreeSpace flow in src/lib/bingo.ts and src/lib/server/cardShuffle.ts, then inspect the affected bingo and tile-admin server routes. Reproduce a 25-tile pool with two free-space tiles and compare the raw and effective counts. Done means the invalid configuration is prevented or normalized, and /bingo no longer renders fewer than 25 cells.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.