Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnakeAI

Note: This project is forked from linyiLYi/snake-ai. See Modifications section for details on what has been changed.

This project contains the program scripts for the classic game "Snake" and an artificial intelligence agent that can play the game automatically. The intelligent agent is trained using deep reinforcement learning with a Convolutional Neural Network (CNN).

Modifications

This fork includes the following enhancements:

Enhanced Training Monitoring

  • Custom SnakeMetricsCallback for real-time TensorBoard logging
  • Tracks game score, win rate, and detailed episode statistics
  • Better insights into training progress

Reward Function Experiments

  • Multiple reward function variations for experimentation
  • Progressive reward scaling based on snake length
  • Configurable reward strategies in snake_game_custom_wrapper_cnn.py

Multiple Training Versions

  • trained_models_cnn_original/ - Original training run
  • trained_models_cnn_v1/ - First experiment
  • trained_models_cnn_v2/ - Second experiment
  • trained_models_cnn_v3/ - Third experiment

🎮 Improved Testing

  • Detailed step-by-step reward logging
  • Min/Max/Average score statistics
  • Configurable render speed and episode count

File Structure

├───main
│   ├───logs                          # TensorBoard training logs
│   ├───trained_models_cnn/           # Default trained model
│   ├───trained_models_cnn_original/  # Original training run
│   ├───trained_models_cnn_v1/        # Experiment v1
│   ├───trained_models_cnn_v2/        # Experiment v2
│   ├───trained_models_cnn_v3/        # Experiment v3
│   ├───trained_models_cnn_mps/       # Apple Silicon model
│   ├───snake_game.py                 # Base game implementation
│   ├───snake_game_custom_wrapper_cnn.py  # Gym environment wrapper
│   ├───train_cnn.py                  # Training script
│   └───test_cnn.py                   # Testing script
├───utils
│   ├───check_gpu_status.py           # CUDA GPU check
│   └───check_gpu_status_mps.py       # Apple MPS check

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages