Skip to content

Trained an AI model to master the Snake game using Python, PyTorch, and Pygame with Reinforcement Learning

License

Notifications You must be signed in to change notification settings

Srilakshmi-mothkur/Snake_AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake AI

Welcome to Snake AI, a Python-based project that combines the classic Snake game with artificial intelligence (AI) to train an agent to play the game autonomously. This project uses reinforcement learning techniques to teach the agent how to navigate the game board, avoid obstacles, and collect rewards.

Features

  • Reinforcement Learning: Utilizes reinforcement learning techniques to train an AI agent.

  • Pygame Integration: Uses the Pygame library for game development and visualization.

  • Training and Evaluation: Allows users to train the AI agent and evaluate its performance over time.

  • Plotting: Includes plotting functionality to visualize the agent's training progress.

    WhatsApp Image 2024-06-07 at 12 44 21_0d844bf7

Installation

To install and run Snake AI on your local machine, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/Srilakshmi-mothkur/snake-ai.git
    
  2. Navigate to the project directory:

    cd snake-ai
    
  3. Install the required dependencies:

    pip install -r requirements.txt
    

Usage

To train the AI agent and visualize its progress, follow these steps:

  1. Run the agent.py script:

    python agent.py
    
  2. Watch as the agent learns to play the Snake game autonomously.

  3. Monitor the training progress with the plot displayed on the screen.

Contributions

Contributions are welcomed. If you'd like to contribute, please follow these guidelines:

  1. Fork the repository and create your branch.
  2. Make your changes and test them thoroughly.
  3. Submit a pull request with a clear description of your changes.

License

Snake AI is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

I would like to thank the contributors to the Pygame library for their efforts in creating an excellent framework for game development in Python.

About

Trained an AI model to master the Snake game using Python, PyTorch, and Pygame with Reinforcement Learning

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages