Psellos
Contemporary Development With Functional Programming

Sliding Tile OCaml iOS App

May 18, 2015

I revamped another OCaml iOS app from a few years ago to make it run under iOS 8.3. It implements a sliding tile puzzle that was a fad in the 1880s and was also popular in my childhood a few years after that.

Instructions for downloading, building, and running the app are here:

Slide24: Sliding Tile Puzzle for iOS

You can download the sources directly here:

Slide24 2.0.2, OCaml app for iOS 8.3 (111 KB)

I had a lot of fun with this puzzle as a kid, and I still find it enjoyable to play with though it’s not particularly challenging to solve. To make the app more interesting, I coded up a heuristic search that solves the puzzle.

Here are some insights I had while revamping the app:

  • iOS devices have gotten tremendously faster since I wrote the code. I should rewrite it to solve with fewer moves. I’d really love to see what an extremely short solution looks like. I’ll bet it looks impossibly wise, like those Swedish girls in First Aid Kit.

  • It’s a little strange for a puzzle to solve itself. Like what if there was a button on the jigsaw puzzle box that made the pieces crawl themselves on the table into the solution. It would be fun to watch, but would it be a puzzle any more? More like a garden I guess.

Now, reader, it’s late at night and I have to rest up. There are exciting new developments in the OCaml-on-iOS world to talk about in the coming weeks. A version of the the iOS cross compiler, much improved with help from the truly knowledgeable, and with support for 64-bit ARM, will soon be available through OPAM. I’m really looking forward to this, and indeed this is why I’m working through these apps as fast as I can. I’m testing them against the new compiler.

If you have any trouble (or success) getting Slide24 to work for you, leave a comment below or email me at jeffsco@psellos.com.

Posted by: Jeffrey

Comments

blog comments powered by Disqus