Skip to content

This is the final project of CPS2232 Data Structure. I use the Q-learning algorithm to play the Snake Game.

License

Notifications You must be signed in to change notification settings

LOUEY233/AI-Snake-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Snake-Game

This is the final project of CPS2232 Data Structure. I use the Q-learning algorithm to play the Snake Game.

Description

This is the snake game. I add one AI player to learn this.

Q-learning:

  • Q-table : hashmap: key:apple position;snake position(String); value: up down left right(float).
  • State: Q-table.key.
  • Reward: distance(-3,0,3), score(80), gameover(-100).
  • Action: Q-table.value.
  • Environment: --.

Q learning setting:

  • greedy 0.3, discount 0.8, learning rate 0.1, action space 4

Document:

  • Board: The playing environment for AI or customer player visualization
  • Game_1: The playing environment for AI training
  • Q_learner: Q learning architecture
  • Snake: costomer player environment
  • SnakeLearner2: AI player environment
  • SnakerLearner3: AI player environment visualization (todo)

Run:

  • if you want to play: Snake.java let AI play: SnakeLearner2.java

Acknowledgement

The game structure is borrowed from java-snake-game. Thanks for your sharing!

About

This is the final project of CPS2232 Data Structure. I use the Q-learning algorithm to play the Snake Game.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages