How priyanshurav/libreludo works
LibreLudo is a browser-based Ludo game for local human and bot opponents. The user journey runs from player setup into a match, where dice rolls and token moves update Redux game state; token movement includes path calculation, capture, and win handling. Saved progress is validated and restored from browser storage. The README documents responsive and offline play, but the sampled sources do not show the full route-to-game wiring or PWA implementation, so those links are marked unverified or omitted.
Main entry points: useMoveAndCaptureToken.ts Move orchestration · Game.tsx Game interface · store.ts Redux store · retrieveState.ts State retrieval
Components 28
Player experience
- Player setup
src/pages/PlayerSetup/PlayerSetup.tsx - Home page
src/pages/HomePage/HomePage.tsx - How to play
src/pages/HowToPlay/HowToPlay.tsx - Play page
src/pages/Play/Play.tsx
Match gameplay
- Game interface
src/pages/Play/components/Game/Game.tsx - Board display
src/pages/Play/components/Board/Board.tsx - Dice control
src/pages/Play/components/Dice/Dice.tsx - Token display
src/pages/Play/components/Token/Token.tsx - Match results
src/pages/Play/components/GameFinishedScreen/GameFinishedScreen.tsx - Bot decisions
src/game/bot/selectBestTokenForBot.ts - Turn and dice flow
src/hooks/useHandlePostDiceRoll.ts - Move orchestration
src/hooks/useMoveAndCaptureToken.ts - Token animation
src/hooks/useCaptureTokenInSameCoord.ts - Motion registry
src/game/movement/tokenMotionRegistry.ts
Game rules
- Move sequences
src/game/movement/calculateSequence.ts - Token rules
src/game/tokens/logic.ts - Board paths
src/game/coords/logic.ts - Token alignment
src/game/tokens/alignment.ts
State and persistence
- Redux store
src/state/store.ts - Player state
src/state/slices/playersSlice.ts - Dice state
src/state/slices/diceSlice.ts - Save and restore
src/game/storage/saveState.ts - State retrieval
src/game/storage/retrieveState.ts - Save validation
src/game/storage/validator.ts - Browser storage
src/game/storage/storage.ts - Save schema
src/game/storage/schema.ts - Game cleanup
src/hooks/useCleanup.ts
Other components
- Local players
Connections 31
- Local players → Home page: opens
README.md - Local players → Player setup: configures
README.md - Player setup → Play page: starts match
- Play page → Game interface: renders
- Game interface → Board display: renders
- Game interface → Dice control: renders
- Game interface → Token display: renders
- Game interface → Match results: shows results
- Local players → How to play: reads rules
README.md - Turn and dice flow → Move orchestration: invokes
src/hooks/useHandlePostDiceRoll.ts - Move orchestration → Move sequences: calculates move
src/hooks/useMoveAndCaptureToken.ts - Move orchestration → Token rules: checks steps
src/hooks/useMoveAndCaptureToken.ts - Move orchestration → Token animation: runs capture
src/hooks/useMoveAndCaptureToken.ts - Token animation → Motion registry: animates tokens
src/hooks/useCaptureTokenInSameCoord.ts - Token animation → Token alignment: resets alignment
src/hooks/useCaptureTokenInSameCoord.ts - Token alignment → Board paths: compares coordinates
src/game/tokens/alignment.ts - Token rules → Board paths: uses path logic
src/game/tokens/logic.ts - Turn and dice flow → Bot decisions: selects bot move
- Move orchestration → Redux store: reads state
src/hooks/useMoveAndCaptureToken.ts - Move orchestration → Player state: dispatches updates
src/hooks/useMoveAndCaptureToken.ts - Redux store → Player state: combines reducer
src/state/store.ts - Redux store → Dice state: combines reducer
src/state/store.ts - Move orchestration → Save and restore: saves next state
src/hooks/useMoveAndCaptureToken.ts - Save and restore → Browser storage: writes save
src/game/storage/saveState.ts - Save and restore → Save schema: shapes save
src/game/storage/saveState.ts - State retrieval → Browser storage: reads save
src/game/storage/retrieveState.ts - State retrieval → Save validation: validates state
src/game/storage/retrieveState.ts - State retrieval → Redux store: hydrates state
src/game/storage/retrieveState.ts - Save validation → Save schema: checks schema
src/game/storage/validator.ts - Game cleanup → Player state: clears state
src/hooks/useCleanup.ts - Game cleanup → Motion registry: clears motion
src/hooks/useCleanup.ts