Added four named bots with distinct playing styles (cautious, bluffer… #3
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/175-add-bots"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was done
packages/client/src/components/Room.tsx).packages/server/src/gameServer.ts).packages/client/src/styles.css).How to review
git diff origin/develop...feature/175-add-bots --stat(you should see the newbots.tsplus changes toRoom.tsx,gameServer.ts, andstyles.css).packages/shared/src/bots.tsfor the four strategies andpackages/client/src/components/Room.tsxfor the roster UI.npm test— all 118 tests should pass, including the per-bot strategy tests and the full four-bot game.npm run typecheck— it should exit clean.npm run dev, then create a room, seat two named bots, remove one, and start the game with one human and one bot — the table should show the bot seats and the game should be in progress.Code review
Reviewed the add-bots change against its proposal, delta spec, design, and tasks: the four-persona roster and pure bid/play strategies in packages/shared/src/bots.ts, the protocol additions, the server's creator-only seat/remove handlers plus persona dispatch in advanceAuto, the creator-only client roster, and the new unit + integration tests all match the spec and are correct. No blocking issues and no code changes were needed. Ran the narrowed test files this change touches (7 files, 67 tests) plus typecheck, all green. Recorded three minor, non-blocking observations (duplicate persona possible via fill:bots, no creator check on the preserved fill:bots hook, and a pre-existing seat-gap when a human leaves the lobby) but left them as-is.
Left for you
packages/server/src/gameServer.ts:539: fill:bots — which the waiting room's 'Fill remaining seats' button wraps — seats roster bots in order without checking for already-seated personas, so filling after manually seating a bot can seat a second copy of the same persona (with a disambiguated name such as 'Cautious Carl 2'). The design explicitly chose 'seats roster bots in order' for the preserved test hook, so this is by design; noted for awareness, not fixed.packages/server/src/gameServer.ts:530: The fill:bots intent has no creator restriction — any seated player can emit it and seat named bots. This is pre-existing test-hook behavior that the design and spec explicitly preserve ('the existing programmatic fill-by-count used in tests SHALL continue to work'), and the creator-facing 'Fill remaining seats' button is only rendered to the creator. Noted for awareness, not fixed.packages/server/src/gameServer.ts:251: Pre-existing (not introduced by this change): when a human leaves the lobby, removePlayer filters the players but does not renumber seats, so a middle-seat leaver leaves a gap (e.g. seats [0, 2]). The engine computes turn order from seat numbers, so a game started afterwards can stall on a phantom seat — the same hazard the new room:remove-bot handler's comment describes and guards against. Left as-is per review scope (this change only renumbers on bot removal).Tests
All 21 scenarios of
add-bots-currently-you-can-only-have-hum-t1ervvhave a tagged test.The test lint recorded nothing in the run's tests.
Braid run
add-bots-currently-you-can-only-have-hum-t1ervv(34 steps).forgejo/workflows,.gitea/workflowsor.github/workflows); what only CI tests went unverifiedOpened by Braid.