This project implements a classic ๐ game with an ๐ค agent that uses a ๐ง neural network to make decisions. The ๐ค is trained through a ๐งฌ genetic algorithm and then tested in the ๐ฎ environment.
The project consists of three main components:
- SnakeGameLogic: Implements the ๐ฎ mechanics for the ๐, including the grid, snake movement, and ๐ generation.
- Agent: The ๐ค agent that controls the ๐, using a simple ๐ง neural network to decide movements based on the current ๐ฎ state.
- SnakeGameGUI: Provides a ๐จ graphical interface for visualizing the ๐ฎ and the agent's actions.
- The agent receives a perception of the ๐, which includes โน๏ธ about the position of obstacles (โ๏ธ), the direction of the ๐, and the relative position of the ๐.
- The agent's decision-making is based on a ๐ง neural network whose weights are optimized through ๐งฌ genetic algorithms.
An issue is currently open due to difficulties encountered when extending the agent's perception to a range of 2๏ธโฃ. When the range_vision
is set to 2๏ธโฃ, the agent tends to perform poorly, resulting in immediate ๐ฎ termination with a score of 0๏ธโฃ. This issue needs further investigation to understand the underlying cause and to improve the agent's performance with an extended perception range.
To run the ๐ฎ with the current best-trained ๐ค:
python snake_game_gui.py
The ๐ฎ will start with the ๐ค controlling the ๐. The objective for the agent is to eat as many ๐ as possible without colliding with obstacles (โฌ๏ธ) or itself.
To report problems or contribute to the solution of the existing issue regarding the range_vision
, please visit the GitHub Issues page and participate in the discussion.
- Python 3.x
- Tkinter (for the ๐จ graphical interface)
- Improve the agent's ๐ง neural network to effectively handle an extended perception range.
- Experiment with different ๐ง network architectures to achieve better performance.
- Address the current issue with
range_vision
of 2๏ธโฃ, ensuring stability and improved ๐ฎ behavior.
Feel free to contribute to the project by opening pull requests or by providing suggestions on the Issues page.