How shogo00713/horsegame works
Horse Game is a browser-based horse-racing betting simulation. Players choose a bet type, horses, and stakes; submitting a valid set of bets starts a race whose result is determined before its animation. The game calculates winning payouts, updates the player’s money and horse conditions, then returns to betting. The graph also includes odds and race-history views, help/tutorial content, and theme controls. Relationships are based on the README and indexed or excerpted source; unsampled implementation details are represented only where documented.
Main entry points: App.tsx Game screen · useHorseGame.ts Game state and flow · Header.tsx Header · BetPanel.tsx Bet panel
Components 26
Application
- React entry
src/index.tsx - Game screen
src/App.tsx - Header
src/components/Header.tsx - Theme state
src/hooks/useTheme.ts - Tutorial state
src/hooks/useTutorial.ts - Game state and flow
src/hooks/useHorseGame.ts
Betting
- Bet panel
src/components/BetPanel.tsx - Bet editor
src/components/BetEditor.tsx - Bet validation
src/logic/checkBetRules.ts
Race and payouts
- Race results
src/logic/determineRaceResults.ts - Odds calculation
src/logic/calculateOdds.ts - Payout calculation
src/logic/calculatePayout.ts - Race animation
src/logic/controlRaceAnimation.ts - Race display
src/components/ResultPanel.tsx - Payout display
src/components/PayoutPanel.tsx
Player support
- Race history
src/components/HistoryModal.tsx - Game guide
src/data/guide.ts - Guide view
src/components/GuideContent.tsx - Menu
src/components/MenuModal.tsx - Tutorial
src/components/Tutorial.tsx
Game domain
- Runner data
src/data/runners.ts - Horse strength
src/logic/calculateHorseStats.ts - Horse conditions
src/logic/updateHorseCondition.ts
Other components
- Player
- Browser
- Browser storage
Connections 35
- Player → Game screen: plays
README.md - React entry → Game screen: mounts
src/index.tsx - Game screen → Game state and flow: uses
src/App.tsx - Game screen → Header: renders
src/App.tsx - Game screen → Bet panel: renders
src/App.tsx - Game screen → Race display: renders
src/App.tsx - Game screen → Payout display: renders
src/App.tsx - Game screen → Race history: renders
src/App.tsx - Game screen → Menu: renders
src/App.tsx - Game screen → Tutorial: renders
src/App.tsx - Game screen → Theme state: uses
src/App.tsx - Game screen → Tutorial state: uses
src/App.tsx - Bet panel → Bet editor: renders
src/components/BetPanel.tsx - Bet editor → Bet validation: validates with
src/components/BetEditor.tsx - Bet panel → Game state and flow: submits bets
src/App.tsx - Game state and flow → Bet validation: checks bets
src/hooks/useHorseGame.ts - Game state and flow → Runner data: loads
src/hooks/useHorseGame.ts - Game state and flow → Race results: determines finish
src/hooks/useHorseGame.ts - Game state and flow → Payout calculation: calculates returns
src/hooks/useHorseGame.ts - Game state and flow → Horse conditions: updates
src/hooks/useHorseGame.ts - Game state and flow → Browser storage: reads and writes
src/hooks/useHorseGame.ts - Runner data → Odds calculation: uses
src/data/runners.ts - Race results → Horse conditions: uses
src/logic/determineRaceResults.ts - Odds calculation → Horse conditions: applies
src/logic/calculateOdds.ts - Payout calculation → Odds calculation: gets multiplier
src/logic/calculatePayout.ts - Race display → Race animation: runs script
src/components/ResultPanel.tsx - Game state and flow → Race display: provides result
src/App.tsx - Game state and flow → Payout display: provides payout
src/App.tsx - Race history → Horse strength: summarizes horses
src/components/HistoryModal.tsx - Menu → Guide view: renders
src/components/MenuModal.tsx - Guide view → Game guide: displays
src/components/GuideContent.tsx - Tutorial → Game guide: displays
src/components/Tutorial.tsx - Header → Race history: opens
src/App.tsx - Header → Menu: opens
src/App.tsx - Player → Browser: uses