# Task ID: 16 # Title: Game End & Settlement System # Status: pending # Dependencies: 5, 15 # Priority: high # Description: Implement the logic and UI for ending a game, determining the winner, and displaying a settlement screen with results and rewards (e.g., experience points). # Details: Backend: When a win condition is met, update player stats (wins, losses, streaks, experience) in MongoDB. Calculate XP based on victory/defeat (win +100XP, loss +20XP). Frontend: Display a 'Game Over' modal/screen showing winner/loser, final board state, and earned XP/rewards. Include 'Play Again' and 'Return to Lobby' buttons. # Test Strategy: Play games to completion (win/loss) and verify correct winner determination. Check if XP and stats are updated in the database. Verify settlement screen displays accurate information. Test 'Play Again' and 'Return to Lobby' functionality.