[q_learning]Snake

less than 1 minute read

Snake (code)

Firstly, I’ve used an observation as differences between coordinates of fruit and snake head. However, It was not working well this observation and also I wanted to try with deep learning with reinforcement learning.

So I searched some of youtube videos that showed how to use CNN with q learning. There is Python Enginner Youtuber.

I’ve learnt from him a lot about Deep Q Learning. So I refered to his code.

After I learned from him, I used the observations same as him and it worked out well.

The observations are 4 directions of danger areas, current direction, 4 directions of fruit. (Meaning of 4 directions is that left, right, down and up from the snake head)

(result)
(average of episode rewards)