A reinforcement learning model for the Da Vinci Code game
flowchart TD
A[Base Game Logic] --> B[Gymnasium Environment]
B --> C[Model Trainer]
C --> D[Trained Model]
A --> E[Web Game Interface]
D --> E
Base Game Logic implements the abstracted game classes and methods necessary for the game to function.
Gymnasium Environment utilizes the game logic to create a Gymnasium environment.
Model Trainer is a PPO trainer modified and refined from rl_adventure2.
- Removed the multiple environment parallel training to reduce complexity.
- Adapted to a multi-discrete action space.
- Added a shared network before the actor and critic networks to improve training efficiency and model performance.
- Included additional graphs (correct count, smoothed graphs) for better monitoring.
- Adjusted hyperparameters to optimize model performance.
Trained Model contains the saved model object for further use in the web game interface.
Web Game Interface utilizes the game logic and the Streamlit library to create a web interface for human players. The model is loaded to play against human players. You can try it out on the Streamlit app deployment.
Be the first to expose your opponents' secret codes before your own is fully revealed.
- Tile Arrangement: 24 numbered tiles divided into two sets:
- Dark tiles: 12 tiles numbered 1-12
- Light tiles: 12 tiles numbered 1-12
- Drawing Tiles:
- Each player draws 4 tiles at random and hides the numbers.
- Sorting Tiles:
- Each player sorts their tiles in numerical order from left to right (lowest to highest). For two tiles with the same number, the dark tile is placed to the left of the light tile.
- Drawing a Tile: On your turn, draw one of the remaining tiles and keep it hidden from other players.
- Making a Guess:
- Choose an opponent and guess the number of one of their tiles.
- Correct Guess: If you are correct, the opponent will reveal the tile.
- Incorrect Guess: If you are wrong, the tile you drew will be revealed and placed in its correct position. This gives your opponents clues about your hidden tiles.
- Continuing Your Turn: If your first guess is correct, you may either:
- Attack another opponent's tile.
- End your turn, in which case the tile you drew will be placed in its correct position without revealing it. Your secret code is now one tile longer.
- Play continues in turns. The game continues until only one player has tiles still unrevealed. That player is declared the winner.