Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Gif

Snake Game AI

Introduction

This program implements an AI agent to play the Snake game. It includes functionality for both training the AI and allowing a player to play the game.

GUI

Training

To train the AI, use the train.py script with the following command-line arguments:

''' python train.py --player [True/False] --cordinates [x,y] --optimization [True/False] --famine [True/False] --load_model [model_name.pth] --save_name [model_name.pth] --h [height] --w [width] --snake_count [number] --food_count [number] --win [True/False] '''

  • player: Specify if player mode is enabled.
  • cordinates: Specify the coordinates in the format "x,y".
  • optimization: Specify if optimization is enabled.
  • famine: Specify if famine is enabled.
  • load_model: Specify the model to load.
  • save_name: Specify the name to save the model.
  • h: Height of the screen.
  • w: Width of the screen.
  • snake_count: Number of snakes.
  • food_count: Number of food items.
  • win: Specify if win condition is enabled.

training

Playing

To play the game, run the make global and make global_run scripts. This will launch a GUI window where you can select the level to play.

playing

Components

agent.py

Contains the implementation of the Snake AI agent.

model.py

Defines the neural network model used by the agent.

conf.py

Contains configuration parameters for training.

train.py

Script for training the AI agent.

gui.py

Script for playing the game using the trained AI agent.

requirements.txt

List of required Python packages.

Notes

  • The code includes both training and playing functionalities for the Snake game AI.
  • The AI agent is trained using reinforcement learning techniques.
  • The game can be played either manually by a player or using the trained AI agent.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages