I’ve decided, at least for the time being, not to finish my adventure book. In the last couple of years, there has been much work on the history of computer games, including adventure games. There is still no book that attempts a complete strategical approach to solving them, I believe, but for instance Jason Dyer uses a quite systematic method on his brilliant Renga in Blue blog. In addition, people like Jimmy Maher are writing in-depth articles that include analyses of the games’ puzzle structures. While an additional book that could fill some remaining niches certainly wouldn’t hurt, I don’t think there’s any real need for it anymore. And with all the other projects I’m working on, abandoning this one will free some time for other work that might be more worthwhile for everyone.
That said, there is one finished chapter left I have not yet posted, and not proceeding with the book seems to be even more of a reason to publish it here. So that’s what I’ll do, as announced in the previous post.
This is the section called “x” in the previous post. It’s probably the section I worked on the longest and most thoroughly, rewriting it numerous times. I had originally planned to flesh it out some more before posting, but it stands on its own as it is, I think, even though it ends rather abruptly.
Number and coding systems
There are numerous books and articles about the basics of digital technology that offer good explanations of number systems and why they are used. Since the present book is not primarily concerned with computer programming, this is only a short excourse. If you need more information, an Internet search will yield many results.
That said, here’s your promised brief look.
We are used to count in decimal numbers, that is, numbers that are expressed in digits from 0 to 9. There’s nothing wrong with that, since we have ten fingers, but computers have only two values to go from: “on” (1) and “off” (0). Again, there’s no problem with that: you can express any numbers using just these two values. When you run out of possibilities, you just add a position, exactly as you would in the decimal system. For example, you notice that you can’t express a number higher than 9 in the decimal system, so you add a position and can now express numbers from 0 to 99. The same goes for the binary system: if you want to add to the highest possible number, 1, you add a position, so that 11 means “2 + 1”, and 111 means “4 + 2 + 1”. At first, this might look a little confusing, but you can think of the positions as powers of a base number. In the decimal system, the number 201 (two hundred and one) really means, “2 · 102 + 0 · 101 + 1 · 100” (2 · 100 + 0 · 10 + 1 · 1), your base number being 10. The binary number 101 (five) works just the same: “1 · 22 + 0 · 21 + 1 · 20” (1 · 4 + 0 · 2 + 1 · 1), with the base being 2. Thus, the base number represents both the maximum number of values a digit can have (0 − 9, or 10 different values, in the decimal system, 0 − 1, or 2 different values, in the binary system) and the number by which each digit is multiplied according to its position. In the decimal system, this is immediately obvious to us, but our brain isn’t used to working with binary values.
This position-based representation leads us directly to the hexadecimal system: if you group four positions of on-off values (also called bits) together, the highest number you can represent is fifteen (23 + 22 + 21 + 20 = 8 + 4 + 2 + 1). This is a rather practical number, since on the one hand the computer is comfortable with four digits as four is itself a multiple of 2, and on the other hand, four is the lowest power of 2 that allows us to represent the number 10, as we are used to. It is so practical, in fact, that at some point, it was decided to make it the base (24 = 16) that is used to represent computer numbers. To that end, it made sense to be able to state these numbers in one position, and so the range of numbers was extended by the first six letters of the alphabet: the digits from 0 to 9 mean the same as they do in the decimal system, and then “A” means ten, “B” means eleven, and so on, up to “F”, or fifteen. Now you can take the idea of positions again and express the decimal number 201 (two hundred and one) as C9, which means, “12 · 161 + 9 · 160 ”. This takes a lot of getting used to, and you should be prepared to have a notepad or a calculator ready whenever you need to convert decimal numbers to hexadecimal or vice versa.
Hexadecimal numbers are normally paired into 8-bit groups (two hex digits). Such an 8-bit group is called a byte and is the smallest addressable memory unit. For most purposes, this is just fine, but in the old days, when memory was still a very scarce resource, there was one drawback involved: if you only really need one or two or five bits but you always use a full byte to store that information, then you waste valuable unused bits. The solution to this problem comes in the form of bit fields or bitmaps – the idea that you store several values of a few bits in the same byte. For example, let’s say your game has seven light bulbs and a dragon. You want to store the state of each of the light bulbs, and you want to store if the dragon is angry or not. So, instead of using up eight bytes of memory, you can express each of your states with one bit and group all of them together in a byte: 0000 0000 if all light bulbs are off and the dragon is friendly; 1111 1111 if all light bulbs are on and the dragon is angry. In decimal, these two numbers are 0 and 255, respectively, in hexadecimal, they are 00 and FF. So at some point in the game, your bit field might look something like this: 1101 0010 – from left to right: light bulbs one and two are on, three is off, four is on, five and six are off, seven is on, and the dragon is friendly. This is the same as the hexadecimal value D2 (decimal 210).
The same system can be applied to other uses, as well. One wide-spread use is for coding graphics, like this hoop:
........ 0h
...**... 18h
..*..*.. 24h
.*....*. 42h
.*....*. 42h
..*..*.. 24h
...**... 18h
........ 0h
(The “h” after the numbers means that they are hexadecimal numbers – which wouldn’t otherwise be obvious here, as there are no letters contained in them.)
The featured image uses a photo by Mika Baumeister.