Skip to content

The Nim game is a mathematical strategy game in which two players take turns removing sticks from distinct heaps. The player who removes the last stick loses. As a game in which states are fully observable and with much reduced state and action spaces compared to chess, it is the perfect game to code a Q-Learning RL agent from scratch.

Notifications You must be signed in to change notification settings

PierreCounathe/Reinforcement-Learning-for-Nim-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reinforcement-Learning-for-Nim-Game

The Nim game is a mathematical strategy game in which two players take turns removing sticks from distinct heaps. The player who removes the last stick loses. As a game in which states are fully observable and with much reduced state and action spaces compared to chess, it is the perfect game to code a Q-Learning RL agent from scratch.

Nim Game (Last Year at Marienbad (1961))

Play the game

  1. Clone the repository:
git clone https://github.com/PierreCounathe/Reinforcement-Learning-for-Nim-Game
cd Reinforcement-Learning-for-Nim-Game
pip3 install -r requirements.txt
  1. Train the Agent and specify its name and number of training_epochs:
python3 main.py --train-ai ai_name 5000
  1. Play against another human or against a trained Agent:
python3 main.py --two-players
python3 main.py --against-ai ai_name 5000

About

The Nim game is a mathematical strategy game in which two players take turns removing sticks from distinct heaps. The player who removes the last stick loses. As a game in which states are fully observable and with much reduced state and action spaces compared to chess, it is the perfect game to code a Q-Learning RL agent from scratch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages