<p dir="ltr">Hi! </p>
<p dir="ltr">I have to implement a solver for the game 2048 and decided to use Haskell from the pool of possible languages. </p>
<p dir="ltr">My current implementation has a fixed recursion depth of 5 and simply sums up the possible score the best line of moves would give. One problem with this implementation is, that in some cases obvious defends are favoured because of the points that the dead end grants in the short term. </p>

<p dir="ltr">So I now want to build up a tree of moves and pick that move that has the deepest subtree. </p>
<p dir="ltr">My problem now is, that I haven't worked with trees before, so I don't have any idea how to build it up recursively. Also, since I don't consider new stones that would spawn after doing my move, I might create infinite subterranean just swiping left and right or up and down or anything else, how would I be able to consider such subtrees as a game over on the first repetition? </p>

<p dir="ltr">TIA<br>
Norbert </p>