How khanlarazizov/domino-game works
This Laravel application exposes a domino game API: a player can authenticate, create a game against bots, and receive game state; bot turns and moves are also represented in services, jobs, and events. GameService coordinates player setup, tile dealing, first-player rules, state initialization, and move dispatch, while repository implementations persist domain records. The README describes Laravel generally, not this product. Edges reflect excerpts and SOURCE INDEX references; unshown route wiring and some runtime behavior are left out or marked unverified.
Main entry points: GameService.php Game orchestration · IBaseRepository.php Repository contracts · GameController.php Game API · MakeBotMoveJob.php Bot move job
Components 21
API and identity
- Auth API
app/Http/Controllers/Api/V1/AuthController.php - Authentication
app/Services/AuthService.php - Game API
app/Http/Controllers/Api/V1/GameController.php - Game response
app/Http/Resources/GameResource.php
Game setup and rules
- Game orchestration
app/Services/GameService.php - Tile dealing
app/Services/TileService.php - Player hands
app/Services/GamePlayerTileService.php - Opening rules
app/Services/GameRuleService.php - Game state
app/Services/GameStateService.php
Turns and bots
- Bot play API
app/Services/BotService.php - Bot move handling
app/Services/BotMoveService.php - Bot strategy
app/Services/BotLogicService.php - Bot move job
app/Jobs/MakeBotMoveJob.php - Human move job
app/Jobs/MakeHumanMoveJob.php - Bot move event
app/Events/BotPlayedTileEvent.php
Domain persistence
- Game participants
app/Models/GamePlayer.php - Player tile records
app/Models/GamePlayerTile.php - Repository contracts
app/Repositories/Contracts/IBaseRepository.php - Eloquent repositories
app/Repositories/Eloquents/BaseRepository.php
Other components
- Player
- Application database
Connections 24
- Player → Auth API: requests login
- Auth API → Authentication: delegates login
app/Http/Controllers/Api/V1/AuthController.php - Authentication → Player: issues token
app/Services/AuthService.php - Player → Game API: requests game
- Game API → Game orchestration: creates game
app/Http/Controllers/Api/V1/GameController.php - Game API → Bot play API: requests bot move
app/Http/Controllers/Api/V1/GameController.php - Game API → Game response: formats response
app/Http/Controllers/Api/V1/GameController.php - Game orchestration → Tile dealing: gets shuffled tiles
app/Services/GameService.php - Game orchestration → Player hands: assigns tiles
app/Services/GameService.php - Game orchestration → Opening rules: selects first player
app/Services/GameService.php - Game orchestration → Game state: initializes state
app/Services/GameService.php - Game orchestration → Bot move job: dispatches bot turn
app/Services/GameService.php - Game orchestration → Human move job: dispatches human turn
app/Services/GameService.php - Bot move job → Bot strategy: uses strategy
app/Jobs/MakeBotMoveJob.php - Bot move job → Bot move event: fires event
app/Jobs/MakeBotMoveJob.php - Bot play API → Bot move handling: coordinates move
- Game orchestration → Repository contracts: uses repositories
app/Services/GameService.php - Tile dealing → Repository contracts: reads tiles
app/Services/TileService.php - Player hands → Repository contracts: stores hands
app/Services/GamePlayerTileService.php - Opening rules → Repository contracts: reads hands
app/Services/GameRuleService.php - Repository contracts → Eloquent repositories: implemented by
app/Repositories/Eloquents/BaseRepository.php - Eloquent repositories → Application database: queries records
app/Repositories/Eloquents/BaseRepository.php - Game participants → Player tile records: owns tile records
app/Models/GamePlayer.php - Player tile records → Game participants: belongs to player
app/Models/GamePlayerTile.php