I've been trying to train a snake for the snake game in DQN. Which the snake can essentially just move up, down, left and right. I'm having a hard time getting the snake to stay alive longer. So my question is, what are some techniques that I can implement to get the snake to stay alive for longer?

Some of the things that I've attempted but doesn't seem to have done much after about 1000 episodes are:

  1. Implementing the L2 regularization
  2. Reduce the exploration decay rate so it give the snake more chance to explore
  3. Randomize the starting point for the snake for each episode to try to reduce "local exploration"
  4. I've tweeked some hyper parameters such as learning rate, policy/target network update rate

The input neurons are fed with the state of the board. For example, if my board size is 12*12 then there are 144 input neurons each representing the space of the environment. I've checked that the loss decreases fairly quickly but no improvements on snake lasting longer in the game.

As a side note my reward function is simply a +1 for every time step that the snake survives.

I'm out of ideas of what I can do to get the snake to learn, maybe 1000 episodes is simply not enough? Or maybe my input is not providing good enough information to train the snake?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.