## Posts

Showing posts from November, 2015

### iPad Pro: Resurrecting the single-device multiplayer game

Back in the mists of time when the first iPad was released there quickly followed a range of games with multiplayer modes for 2-4 players. Some used the sides of the screen, some the corners, and others split the screen in two.

The size of the iPad Pro, which is closer to the size of a gaming board than any other iPad thus far, started me thinking about whether all those old games would still run in iOS 9.1 on the Pro, and what they'd be like. It turns out that the games I remember playing back on the iPad 1 (with a single exception) still run and are well suited to the larger iPad with far less finger clashing (and lag) than before.
Multiponk by Fingerlab (£2.29/\$2.99) This first game took me a while to track down because I couldn't remember the title but sifting through the bottom of my purchased list (for the oldest apps I own) I located Multiponk, a 1-4 player game deflecting ball bearings to stop them getting past your bat. It's a must play for those seeking a multipl…

### Bytes for Beginners: Representation of negative numbers in binary using Swift (two's complement)

When I initially wrote the bytes for beginners series of posts I never got around to discussing the representation of negative numbers in binary or how we might use Swift to understand this.

So let's begin now with bit casting, which is the act of transforming a bit of one type into something of another type. Here's an example, we have a UInt8 (an unsigned 8-bit integer), which can store any number from 0 to 255 and we want to cast it to an Int8 (a signed 8-bit integer), which holds a number from -128 to 127.
unsafeBitCast(UInt8(128), Int8.self) // -128 unsafeBitCast(UInt8(255), Int8.self) // -1 What is happening here is easiest explained by Dr. Math:
The numbers 0 to 127 are positive; numbers 128 to 255 represent -128 to -1. So if we think of this in binary terms
String(128, radix:2) // 10000000 String(255, radix:2) // 11111111 then 10000000 in what is known as a two's complement representation (or Int8's language) is -128, where in the language of UInt8 it repre…