Project developed at the college as a final work for the artificial intelligence subject
Original code developed between May 15, 2018 - Jun 29, 2018
Install dependencies
pip install -r requirements.txt
Run
python game.py
- Pygame: Used in game development and user interaction
- neat-python: Python implementation of the NEAT neuroevolution algorithm
- F1: Takes control of the game, making it possible to control the snake's movements with the keyboard arrows
- F2: Sets a high frame rate (fast) until the snake dies
- F3: Sets a low frame rate (slow) until the snake dies
- F4: Enable the debug draw, drawing input indicators
SnakeLength - TurnedQuantity * 0.01
-
SnakeLength: Snake length defined by how many apples it ate
-
TurnedQuantity: How many times did the snake change direction, either left or right
- cd_left: Collision-free units at left
- cd_top: Collision-free units at top
- cd_right: Collision-free units at right
- cd_bottom: Collision-free units at bottom
- cd_top_left: Collision-free units at top left
- cd_top_right: Collision-free units at top right
- cd_bottom_left: Collision-free units at bottom left
- cd_bottom_right: Collision-free units at bottom right
- apple_x_distance: If there is an apple on the right or left, this variable contains the distance in units to the apple
- apple_y_distance: If there is an apple on the top or bottom, this variable contains the distance in units to the apple
You can "see" these inputs in debug mode
- 0: Don't change direction
- 1: Turn right
- 2: Turn left