Skip to content

KumarSampurn/Snake-Game-RL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game with Reinforcement Learning using Pygame, PyTorch, and Q-Learning

This project combines the classic Snake game implemented in Pygame with reinforcement learning techniques using PyTorch and the Q-learning algorithm. The goal is to train an AI agent to play the Snake game optimally through reinforcement learning.

Requirements

  • Python 3.11
  • Pygame
  • PyTorch

Installation

Clone the repository: git clone https://github.com/KumarSampurn/Snake-Game-RL.git

Usage

  1. Run the main script to start training the reinforcement learning agent:
    python agent.py
    
  2. The Snake game window will open, and the agent will start training. You can observe the game and training process in the window.

Files

  • agent.py: This script contains the main functionality for training the reinforcement learning agent and fines the reinforcement learning agent using the Q-learning algorithm with PyTorch..
  • game.py: Implements the Snake game using Pygame.
  • model.py: Initializes the pytorch model.

Acknowledgements

This project is inspired by the combination of classic games and reinforcement learning techniques. Thanks to the FreeCodeCamp for helping with this.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributions

Contributions are welcome! Feel free to submit issues or pull requests to help improve this project.

Contact

For any inquiries or suggestions, please feel free to contact ksampurn@gmail.com.

Enjoy playing and training your Snake AI with reinforcement learning! 🐍🎮

Screenshots

Overall System

Overall System

Game Screenshot

Game Screenshot

Performance

Performance

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages