Scribble app#92
Open
GaddamMeghana29 wants to merge 11 commits into
Open
Conversation
- Fix VITE_API_URL default (removed /bug suffix) - Add isHost flag to Participant model and propagate through store - Update room code format to 4 uppercase letters (A-Z only) - Tighten playerName validation: trim + min-length via Zod - Add case-insensitive duplicate name rejection (409 on join) - Add startRoom() with host-only gate and 2-player minimum - Add POST /rooms/:code/start route with error mapping - Replace manual Refresh button with 2s polling in LobbyPage - Show host badge and conditional Start Game / waiting message - Add 16 unit tests covering all four user stories Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extend RoomStatus to include "game" state - Add drawerId and currentWord to Room model - startRoom() mutates room: sets status, assigns drawer, selects word - toRoomSnapshot() filters currentWord for non-drawers; adds wordLength - createRoom() initialises drawerId/currentWord to null - LobbyPage auto-redirects to /game when room.status === "game" - GamePage: one-time fetch on mount; shows drawer identity and word - Drawer sees secret word; guessers see underscore placeholder - sessionStorage persists participantId across page refreshes - 24 backend unit tests passing; both builds clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…essing, history) - Add Stroke/GuessEntry entities to Room model and RoomSnapshot - Implement addStroke() and submitGuess() service functions with validation - Add POST /rooms/:code/strokes and POST /rooms/:code/guesses API routes - Upgrade GamePage from one-time fetch to ~2s setInterval polling - Implement HTML5 Canvas drawing for drawer (normalized coords, one POST per stroke) - Add guess input with immediate isCorrect feedback and page-refresh restoration - Add chronological guess history visible to all players - 36 unit tests passing (12 new for addStroke/submitGuess/snapshot assertions) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extend RoomStatus with "ended" state; submitGuess() atomically transitions the room to "ended" when a correct guess is recorded - Modify toRoomSnapshot() to reveal currentWord to all players when status is "ended" (word is no longer hidden after game concludes) - Add resetRoom() (host-only) that resets room to "lobby" and clears strokes, guesses, drawerId, and currentWord while preserving participants - Add POST /rooms/:code/reset route and resetRoomSchema for Play Again - Add api.resetRoom() to frontend API client - Add ResultsPage (/results): shows revealed word, winner name, and complete guess history; host sees Play Again button, others see waiting message; polls every ~2 s and redirects to /lobby on reset - GamePage now redirects to /results when polling detects status === "ended" - Update existing already_correct test: after a correct guess the room is "ended", so a second attempt returns not_in_game (not already_correct) - Add 10 new unit tests covering game-end transition, word reveal, and resetRoom happy/error paths (46 tests total, all passing) - Add Scenario 4 spec, plan, research, data-model, contracts, quickstart, and tasks artifacts in specs/004-game-end-results/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers all four scenarios, key technical decisions (atomic game-end, polling-only real-time, snapshot word-reveal), and the Spec Kit workflow experience. Fixes the pre-evaluation CI failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Organised around what the starter had, what was added per scenario, the Spec Kit workflow, and what I'd do differently next time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements all four gameplay scenarios for the Scribble multiplayer drawing-and-guessing assignment on top of the provided starter, following the Spec Kit workflow (specify → clarify → plan → tasks → implement) for each scenario.
"ended"; all players auto-redirect to Results screen via polling; Results screen reveals secret word, names winner, shows full guess history; host can Play Again (resets to lobby, all players redirect automatically); non-host sees waiting messageArchitecture
Map<string, Room>; Zod schema validation; Vitest unit testsRoomStatusextended to"lobby" | "game" | "ended"Key changes
backend/src/models/game.tsStrokePoint,Stroke,GuessEntryinterfaces; extendedRoom+RoomSnapshot; added"ended"toRoomStatusbackend/src/services/roomStore.tsaddStroke(),submitGuess()(with atomic game-end),resetRoom(); updatedtoRoomSnapshot()to reveal word when endedbackend/src/api/rooms.tsPOST /:code/strokes,POST /:code/guesses,POST /:code/resetroute handlersbackend/src/services/roomStore.test.tsfrontend/src/pages/GamePage.tsx"ended"frontend/src/pages/ResultsPage.tsxfrontend/src/routes/index.tsx/resultsroutefrontend/src/services/api.tsaddStroke(),submitGuess(),resetRoom()API methods; updatedRoomStatustypespecs/Test plan
cd backend && npm run build— zero TypeScript errorscd frontend && npm run build— zero TypeScript errorscd backend && npm test— 46/46 tests passingspecs/004-game-end-results/quickstart.md:Contributor
- [ ] Product
- [x] Developer