Snake – First published by Nokia, for monochrome phones. It was programmed in 1997 by Taneli Armanto of Nokia and introduced on the Nokia 6110.
This project is about implementing the reinforcement learning algorithm Deep Q-Learning on the Nokia's Snake Game to predict the actions. It makes use of the Python's Pygame and Pytorch libraries.
A virtual environemnt is created and activated by running the following commands:
- conda create -n pygame_env python=3.7
- conda activate pygame_env
The following commands are used to install pygame, torch and matplotlib:
- pip install pygame
- pip install torch torchvision
- pip install matplotlib ipython
- Rule of the Game: Snake should not hit the boundaries and itself.
- Process:
- Initially, snake knows nothing about the game. It is only aware of the environment and tries to make more or less random moves.
- With each move and game, it tries to learn more.
- In this project, after about 80 game iterations (around 10 minutes), it knows how to play better through improvement.
Reinforcement.Learning.-.Snake.Game.mov
Output at Iteration 100: