This project implements a Reinforcement Learning (RL) agent to play the Suika Game (Watermelon Game) using Deep Q-Networks (DQN).
Make sure you have Python 3.10 environment. Then install the required packages:
pip install -r requirements.txtWe have provided a pre-trained model: suika_dqn_mlp_final.zip. To watch it play:
python rl_env/test_model.py --model suika_dqn_mlp_final.zipOptions:
--episodes N: Run for N episodes (default: 1).--fps N: Limit playback speed to N FPS (default: 60).--stochastic: Use random actions based on probabilities (default: deterministic/best action).--empty: Start with an empty board (no initial random fruits).
Example:
python rl_env/test_model.py --model suika_dqn_mlp_final.zip --episodes 3 --fps 120If you want to play the game manually using your mouse:
python rl_env/human_play.py- Controls: Move mouse to position the cloud, click to drop the fruit.
To train a fresh agent or continue training:
python rl_env/train.pyThis will save checkpoints to models_dqn/ and logs to logs_dqn/ in the current directory.
suika_dqn_mlp_final.zip: The final trained DQN model ready for testing.rl_env/: Contains the Reinforcement Learning scripts.test_model.py: Script to load and watch a trained model play.train.py: Script to train the DQN agent.human_play.py: Script for human gameplay.suika_env.py: The Gymnasium environment wrapper for the game.
suika/: Contains the core game logic and assets. Taken from an open source project seen here: https://github.com/Ole-Batting/suikarequirements.txt: List of Python dependencies.