Posted Sat 11 Apr 2020 by Michael Patricios , 0 comments

Quite a while back there was a xkcd post showing the complete map of optimal tic-tac-toe moves. Ever since seeing it I've wanted to create an interactive version of this that would show a visualisation of the game tree for each possible move, and here it is! You can try it online or check out the source code repository. It runs in a web browser and the code is TypeScript.

Tic-tac-toe-ception screenshot

Updated Thu 28 Nov 2013 by Michael Patricios , 10 comments

A while ago I needed to allow users to enter a monetary value into a text input in an iOS app. There seem to be a few approaches to doing this, such as:

  • Use a text field with a full keyboard and validate what the user entered, or only accept numeric input and a period or comma character
  • Use a text field with a numeric keypad, but don't allow minor units (cents/pence) as there is no period or comma character available on this keypad
  • Use spinners

To me, none of these options gives a good user experience; I find the best approach is what many ATMs do, which is to allow you to enter only the digits, but have a fixed decimal separator. So, to enter '123.45' you would type 1-2-3-4-5; to enter '18.00' you would type 1-8-0-0; and so on.

In this post, I am going to do this in iOS with a text input and a numeric keypad. The Objective-C code for this is available on github.

Decimal text input

Posted Sat 02 Nov 2013 by Michael Patricios , 0 comments

If, like me, you have iOS projects that use custom table cells in table views, you may have noticed that when rebuilding the projects for iOS7, table cells are always rendered with a white background, which means if your custom table cells have their own background you may not see it. The solution to this problem can be found in the UITableViewCell Class Reference:

Updated Sun 02 Sep 2012 by Michael Patricios , 0 comments

I recently built a simple retro snake game in javascript, with the game rendered on an HTML canvas and hi-scores in HTML local storage. You can play it online, or grab the source from github.

Canvas snake screenshot

Update: I've written a CoffeeScript version too, the source is on github.

Posted Tue 10 Jan 2012 by Michael Patricios , 0 comments

I've started using TexturePacker from Code'n'Web. There are versions for several platforms (including Mac OS X) and it can be easily integrated into your XCode build toolchain. It can also create standard definition textures and atlases from the high definition (i.e. retina-display) texture, and much more.. It has saved me a lot of time - if you're building a game with lots of sprite atlases, take a look at this tool. Well worth the US$24.95 asking price for the full version.


Older postsPage 1 of 3