Psellos
Life So Short, the Craft So Long to Learn

How to Code an OCaml iPhone App: Sliding Tile Puzzle

February 1, 2011

I just spent a few days writing an example OCaml iPhone app with a more realistic feel. It plays a puzzle that I really liked as a kid, the 5 x 5 sliding tile puzzle.

If you’re too pressed for time, it will solve the puzzle for you using a heuristic search algorithm taken from the AI guys. According to Wikipedia, robotic cars use a similar algorithm to drive through the desert while avoiding cactus.

The interface uses Cocoa Touch animations, which make it quite fun to watch. I’m giving it away free to fellow OCaml developers, though in fact, I would probably be willing to pay a dollar for it.

You will find sources and a description of how to build the app here.

Posted by: Jeffrey