I was working on a little project and the basic idea is to have a neural network learn how to play 2048. Because the next move in the game is not dependent on the previous moves, I think a fully connected neural network would do fine here.

I am just totally stuck at how to train the network.For things like the MNIST Dataset, I've used the MSE as the cost function.

But how could I learn a network to play 2048 and what cost function do I have to use and on what data do I use it?

Greetings, Finn

  • $\begingroup$ I have not played the game myself much, but aren't the current locations of the squares and the numbers on them dependent on your previous moves? $\endgroup$
    – Zhubarb
    Jan 17, 2018 at 8:15
  • $\begingroup$ That's the case with every game but your next move is independent on the previous moves $\endgroup$ Jan 17, 2018 at 8:16
  • $\begingroup$ Your move this turn will affect your rewards going ahead 10 turns though, is that not the case? To me it sounds like you should look at reinforcement learning to focus on potential future results (more profitable combinations) rather than immediate score gain like in this in which they use neural networks to replace the action-future reward (Q) value look-up table in a Markov decision process. $\endgroup$
    – Zhubarb
    Jan 17, 2018 at 8:21
  • $\begingroup$ I think he meant that the game state is dependent only on the current situation of the board, just like in chess or go. You can choose best action using only information from a frozen frame, which is not the case for example in pong (since you wouldn't know which way the ball is going if you had only one frame. $\endgroup$
    – Lugi
    Jan 17, 2018 at 11:35

1 Answer 1


This is a reinforcement learning objective, and it's somewhat different from supervised learning you've been doing with the MNIST dataset.

Start with this: https://keon.io/deep-q-learning/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.