Back to projects
DP Snake Game

DP Snake Game

Hamed Bahram / September 16, 2024

This project implements the classic Snake game with an AI agent that uses Dynamic Programming and Reinforcement Learning algorithms to improve its gameplay strategy over time. The goal is to develop an intelligent agent capable of optimizing its movements and learning from its interactions with the game environment.

You can view the code on GitHub here.

Features

  • Dynamic Programming: Utilizes dynamic programming to optimize the AI agent's decisions and movements.
  • Reinforcement Learning: The AI learns and adapts using reinforcement learning techniques to improve its strategy.
  • User Interface: A simple, interactive UI that allows players to observe the AI or play the game themselves.

Technologies

  • Python 3.x: The project is implemented in Python.
  • Reinforcement Learning: Algorithms are used for training the AI to adapt to the game environment.
  • Dynamic Programming: Optimizes pathfinding and decision-making for the AI agent.
  • Pygame: A library used to create the graphical interface for the game.

Getting Started

To run the Snake game with dynamic programming and reinforcement learning, follow these steps:

  1. Clone this repository to your local machine:
git clone https://github.com/skh113/dp-snake-game.git
  1. Navigate to the project directory:
cd dp-snake-game
  1. Install the required Python libraries:
pip install -r requirements.txt
  1. Run the game:
python agent.py

Contributing

Contributions are welcome! If you have suggestions, bug reports, or feature enhancements, feel free to open an issue or submit a pull request on GitHub.

Conclusion

The DP Snake Game combines dynamic programming and reinforcement learning to create an AI that can learn and improve its strategy over time. By integrating these techniques, the AI becomes more efficient at navigating the grid and consuming food, offering a unique challenge and learning experience for players and developers alike.