Writing a 2048 clone in elm

comments

Several weeks ago, I, along with the rest of the internet, discovered 2048, a fascinating one player game based on powers of two. Although it has a simple premise, the game requires a complex set of carefully thought out non-linear strategies to win, in a way that makes it comparable to a Rubik’s Cube, or the two player game Go.

There are many interesting mathematical questions one could ask about the game, both trivial and non-trivial. For example:

  1. What is the least number of moves required to win?
  2. What is the lowest possible score when the game is won?
  3. What is the highest number of moves that can be carried out before a win?
  4. What is the lowest possible score when the game is lost?
  5. Is a win always guaranteed?

I intend to try to tackle some of these in another post.

For now, I have applied my new found love for functional programming and created a clone of 2048 in elm. Elm is a programming language based on Haskell that uses Functional Reactive Programming to enable the creation of interactive applications, while keeping the language functional.

Read more

Greetings.

I’ve attempted several times in the past to begin some kind of a blog. I’m not sure I ever thought I had anything interesting to say (and so was never able to post very much), but rather wanted to build a website for my own amusement. The latter is still very much the case, but I feel as though I am reaching a point where I might have some content worth posting. I am not entirely certain this is the case, but I suppose we shall see.