[Haskell-beginners] Building a tree
Norbert Melzer
timmelzer at gmail.com
Mon Apr 28 15:49:28 UTC 2014
Hi!
I have to implement a solver for the game 2048 and decided to use Haskell
from the pool of possible languages.
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.
So I now want to build up a tree of moves and pick that move that has the
deepest subtree.
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?
TIA
Norbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140428/d792d53b/attachment.html>
More information about the Beginners
mailing list