A high-performance React and Redux-based simulation engine designed to model, analyze, and visualize UNO-style gameplay. This project features "Greedy Strategic" AI agents, a real-time data visualization dashboard, and a persistent game auditing system.
- Strategic AI Players: AI agents use a "Greedy Strategic" sorting algorithm, prioritizing high-value cards (Wilds, Special cards) to minimize score penalties and maximize control.
- Check-After-Draw Logic: Mirroring human play, AI agents evaluate cards immediately after drawing. If a playable card is drawn, it is played in the same turn, significantly increasing game efficiency.
- Real-Time Analytics Dashboard: Built with Chart.js, providing insights into:
- Win Distribution: Tracking player success rates to identify first-player advantage or AI bias.
- Granular Card Frequency: Bar charts tracking the play rates of every individual card value (0-9 and action cards).
- Game Duration Trends: Monitoring turns-per-game to evaluate simulation speed and competitiveness.
- Advanced Turn Auditing: A comprehensive
TurnLogTablethat provides:- Hand Snapshots: View the exact state of a player's hand before every play, rendered as styled card assets.
- Player Filtering: Drill down into specific AI behaviors by filtering the log by player.
- Outcome Summary: Clear visual indicators for winning plays (🏆) and a final Game Outcome summary for all participants.
- Data Persistence: Integrated with Auth0 for user identity and a database backend to maintain longitudinal statistics across sessions.
- Frontend: React (Hooks, Context, Memoization)
- State Management: Redux Toolkit (Slices, Thunks)
- Styling: Tailwind CSS
- Charts: Chart.js / react-chartjs-2
- Auth: Auth0
- Storage: Database (Primary) / LocalStorage (Backup Turn Logs)
The simulation employs a strategic sorting mechanism. Before searching for a playable card, the AI sorts its hand based on point values:
- 50 Points: Wilds & Wild Draw Fours (Highest Priority)
- 20 Points: Skips, Reverses, Draw Twos
- 0-9 Points: Number cards (Lowest Priority)
By prioritizing these cards, the AI avoids getting "caught" with high-value cards at the end of the game and maintains better control over the game's flow.
The introduction of strategic sorting and draw-time evaluation led to:
- Balanced Win Rates: Improving the AI's efficiency nearly eliminated the inherent first-player advantage, leading to a much more even win distribution.
- Score Optimization: Average losing scores dropped by approximately 5 points as AI players became better at purging high-value cards.
- Strategic Depth: While game length remained stable, the frequency of defensive plays (Skips/Reverses) increased, indicating a more competitive "tug-of-war" dynamic.
- Clone the repository.
- Install dependencies:
npm install - Set up your
.envwith Auth0 credentials. - Launch the simulation:
npm start