Tuesday 4 May 2010

A detailed mathematical and historical analysis of four of the challenges encountered in the game L – A Mathemagical Adventure

Introduction

L – A Mathemagical Adventure (hereinafter referred to as L) is a text-based single-player role-play computer game produced in 1984 by the Association of Teachers of Mathematics (ATM, no date), aimed at Key Stages 2 to 4. Originally designed to run on the BBC platform then more or less common in schools, the game is similar in format to other text-based games, such as Zork (Barton, 2007): the player has a quest – in this instance, to rescue a fair maiden named Runia; to achieve this objective, the player must overcome obstacles, defeat fearsome enemies, solve puzzles, and so forth; and the play is controlled by means of a set of relatively simple commands. Despite its single-player setup, there are opportunities for shared gameplay, discussion and co-operation in solving the puzzles presented.

The scenario contains references throughout to the literary works of Lewis Carroll, who – as Charles Dodgson – was an eminent Victorian mathematician with a predilection for games and puzzles. The puzzles are, naturally, mathematical. Some are relatively easy, others less so; and a few seemingly innocent tasks conceal problems of considerable depth and antiquity.  This paper will explore the solution and pertinent history of four of the tasks: the telephone; the bat room; the code room; and baking a cake.

My route through the palace was fairly systematic. In each room or area, I initially travelled east, then explored other routes in an anticlockwise direction. Having selected a direction, I explored it as far as possible, retracing my path backwards in stages to the first room after attempting all the tasks.


The Telephone
The telephone room is at the north end of a corridor to the west of the workshop. The possible phone numbers run from 000 to 999 (see Figure 1). The telephone itself is a red herring in the quest: no useful information is revealed in solving this puzzle. It is the chest on which the telephone sits that is important. Due to the route taken, this was one of the last places I looked: I was laden with objects and it is only thanks to a friendly games guru that I realised I had to drop them all to move the chest. I initially tried a few likely numbers (000, 111, etc.) to no effect. I then tried prime numbers, and got messages for 002, 003 and 005. When 007 yielded nothing, I tried 008, the next Fibonacci number, and on its success I tried the remaining Fibonacci numbers below 999 – 16 in all (see Appendix 1).

The Fibonacci sequence is named after Leonardo of Pisa [1] (O’Connor & Robertson, 1998) -nbsp;undoubtedly the 13th century Italian mentioned in one of the telephone messages. It appears in his Liber Abaci, in which he also introduces place-value decimal numbers. Fibonacci came to the attention of the Holy Roman Emperor, Frederick II, and his court. He was set a series of problems, including a problem regarding rabbit populations (see Figure 2). Starting with a pair of rabbits, and assuming they mature at one month old and produce young at two months old, how many pairs of rabbits would there be at the end of any given month? Fibonacci determined that the number of pairs in any one month was equal to the sum of the pairs in the previous two months: 1, 1, 2, 3, 5, 8 being the number of pairs in each of the first six months.

Had the sequence remained in the sphere of population dynamics, it would have been of limited use: none of Fibonacci’s rabbits ever die, for example, and continue to breed unabated by considerations of food supply, or, indeed, the walls surrounding their habitat as described in the original problem. However, the sequence has found applications in such a wide arena that there is a scholarly journal, the Fibonacci Quarterly, is devoted to its academic study. An examination of the L telephone messages reveals some of the areas in which the Fibonacci sequence has been applied:

001, 377:  meteorology (Swinbank & Purser, 2006);
013:          botany and biology (Knott, date unknown);
089:          economics (Frost & Prechter, 1998);
114:          sports and betting (O’Connell, 2008).

An unusual property of the Fibonacci sequence is that, when each number in turn is divided by its predecessor, the results converge on a curious number known as ϕ (phi), or the Golden Ratio. This number is found in nature, in architecture, art, music, geometry, and visual perception; it appears to underlie our notions of beauty; and has even inspired authors such as Dan Brown. Its pervasiveness is such that some see it written by the hand of God (Meisner, date unknown).

Surprisingly then, under the circumstances, I have been unable to establish a link between Lewis Carroll’s Alice and the Fibonacci sequence, except for the rather trivial coincidence that both began with rabbits.

[1]: Leonardo was a member of the Bonacci family: Fibonacci may be a contraction of figlio Bonacci – son of Bonacci.


The Bat Room
The Bat Room occurs towards the end of the game. The solution to this puzzle, any triangular number between 20 and 90, is one of the most clearly signalled in the game: the room has a triangular floor and walls. If this were an insufficient clue, any mistake causes the large bat to write out a triangular list of numbers, declaring that he hates anything that is not triangular (see Figure 3). This hint is repeated every time an error is made; any attempt to leave without completing the task causes the bats to swarm around the door, making escape impossible.

The triangular numbers are one of a class of numbers known as ‘figurate’, meaning that each term can be represented as a figure: graphically as a pattern of dots, or physically using counters, bottle tops, etc., where they can be used to teach younger students about the relationships between numbers, patterns and graphical representation. Such figures are regular geometric shapes – triangles, squares, pentagons, and so forth (Weisstein, date unknown–a). The figurate numbers are widely studied in number theory, but the triangular numbers attract considerable interest as they pop up in a variety of different equations, such as the sum of consecutive integers, square numbers, Pascal’s Triangle, and even integrals (Weisstein, date unknown – b). The most famous triangle number is the infamous 666, the so-called Number of the Beast. Sadly, the true Number of the Beast according to modern Biblical scholarship is the rather less inspiring 616.

The link to Lewis Carroll’s work in this task is again somewhat tenuous. The Bat was the nickname for Bartholomew Price, a professor of mathematics at Oxford known to both Lewis Carroll and Alice Liddell, the model for Alice, and Carroll parodies a well-known nursery rhyme through the voice of the Mad Hatter:

Twinkle, twinkle, little bat
How I wonder what you’re at!
Up above the world you fly
Like a tea-tray in the sky.
Twinkle, twinkle, little bat
How I wonder what you’re at!

The Code Room

The code room is located to the south of the billiards room, through an anteroom, and was thus located at an early point in my quest. In the code room, the screen fills with apparently random letters, digits and punctuation marks (see Figure 4). I solved this by making a codebook: typing each line of keys on the keyboard, and writing down the resulting text (see Appendix 2). Fortunately, it turned out to be a simple substitution code. Despite my lack of gaming knowledge, I knew that there should be a device in the room which would return its appearance to normal, and this turned out to be the case. I kept the glasses with me for the rest of the quest: this was not necessary for all the tasks, but a few did turn into code if I had to set the glasses down.

Codes have a history beyond the scope of this paper, ranging from military ciphers to Victorian flower language. Much ingenuity has gone into producing unbreakable codes for military and political uses, where a variety of techniques and devices have been employed – once-only codes, and the Enigma machine are examples. While many early codes were simple substitution codes such as found in the code room, there has been a progressive move toward mathematically-based codes and ciphers – and the use of mathematical techniques in cracking them. Naturally, as codes became more complex, computers are needed: it is arguable that computers would not be the household item they are today, if they had not been necessary for code breaking in the Second World War. Today, encryption is a major area in computer and internet security.

Dodgson was greatly interested in cryptography both recreationally and academically, and is known to have produced several ciphers, including a matrix cipher (Abeles, 2005). Some of these ciphers cunningly included nulls – non-code characters, or code characters used randomly – to disguise the meaning further. He used these codes to write letters to friends, and to remember dates.

Baking a Cake

The new kitchen is situated on the east of the palace, almost opposite the old kitchen near the game entrance. A cook needs to bake a cake at least 25cm high, using three ingredients, TOLT, FIMA and MUOT, in grams. The scenario glosses the soup-making episode in Alice in Wonderland, substituting a salty cake for the over-peppered soup.


Initially, I attempted to use the codebook on the ingredient names. I tried to find another code or language that might convert the letters into digits, sums, four-letter number names, ingredients with four letters (e.g., eggs or soda), or even four-letter acronyms. Finally, I tried simply putting in random numbers. More than 100g was declared ‘wasteful’ by the cook. By systematically changing one number at a time, I found a rough relationship similar to a Bell curve between the ingredients and the cake: that is, up to a point, increasing the ingredients increased the size of the cake, but beyond that, the cake decreasing in size. However, I was unable to find any distinct mathematical relationship, such as Pythagorean Triples.

Then I had a happy accident. Having found that 6g TOLT, 10g FIMA and 8g MUOT produced a 25cm cake, I decided to leave the game but forgot to save my position. When I went back in, I accidentally typed 10g MUOT instead of 8g – and it worked. After another 20 or 30 tries, I determined that 5, 6 or 7g of TOLT, 10-18g inclusive of FIMA, and 1-100g inclusive of MUOT, in any combination, produced a cake of the desired height.

It would be disappointing if this task, which must on average take players more time to complete than any other, were merely some kind of trial and error problem. I searched for more possibilities, but with little success. However, amongst the extra pieces of information I gleaned was that Dodgson had done some research on matrices, or ‘blocks’ as he called them, and had produced a method for finding determinants, known as Dodgson’s Condensation, which remains one of the most efficient to date (Dodgson, 1867). I also discovered, quite incidentally, that a contemporary of his, Sylvester, worked on the determinants of rectangular matrices (Weisstein, date unknown-c). It then occurred to me that the ingredients could be arranged into a rectangular 3 x 4 matrix of letters, with 25 perhaps representing a determinant. Unfortunately, I could go no further forward with this idea – partly because the mathematics is currently beyond me, and partly because there is still a crucial element missing: the key to the matrix. I was unsuccessful in finding a copy of Dodgson’s matrix cipher, which may be the key – assuming, of course, that I am not seeing patterns where none exist.


Conclusion

As a disclaimer, I should say that I have an intense dislike of computer games. This dates back to my early experience of programming in the mid to late 1980s, when running silly games on a computer was irresponsible and wasteful. However, I do acknowledge that some games can be educational, and therefore worthwhile. L – A Mathemagical Adventure has thus been an interesting look at the possibilities of such games. I found there is plenty of food for more advanced thought – up to A Level and beyond in some tasks. The literary allusions are amusing, and could be useful in broadening students’ views on mathematics, too.

When drawing the map, I noticed that the palace is missing much of its ground floor. Perhaps it is a fully-working evaluation copy, missing some additional ‘levels’: some objects are of no use; some tasks are unconnected to the quest; and there are unresolved issues at the end of the game. If so, then I would love to play a full version – which is high praise indeed.