Wednesday 30 March 2011

Cheltenham Skeptics in the Pub

On Tuesday evening I went to Cheltenham Skeptics in the Pub to see Christopher French do a talk. The talk itself was good, but what I want to write about is a little episode of non-critical thinking on my part.

When I got there, I wanted a drink, but there were a lot of people at the bar, and only one bar tender who didn’t seem to be moving very quickly. I noticed that this bar sold Budvar Dark on tap, and I thought "The last pub I went to with Budvar Dark on tap had really slow service too!"

I don’t really think that the drinks on sale effect the speed of service at a pub (well, except for Guiness) but for a second, I thought I’d stumbled upon something.

Wednesday 23 March 2011


When I was young, one thing about adults that always impressed me was the number of keys they had. Keys for front and back doors, sheds, cars, garages, lockers at sports clubs, and any number of mysterious ones that never seem to be used but are important enough to be always to hand. It seemed like a terribly grown up thing. A symbol of importance and responsibility. People are relying on you to protect and allow access to certain areas.

Right now, I have three keys on my key ring.

I think the younger me would be somewhat disappointed.

Of course he’d be amazed at my tiny telephone, mp3 player, computer and Nintendo DS but, that aside, he’d be unimpressed by my lack of keys.

Friday 11 March 2011

Chess in 1K

Since it's the 30th anniversary of the ZX81 computer, I thought I'd write about what I think is one of the most amazing pieces of programming ever: 1K ZX Chess.

In 1983, David Horne wrote a program that would play a game of chess that ran on the Sinclair ZX81 computer using just 1K of memory. As one of the smallest versions of the game to have a visual display of the board, it stands as a remarkable achievement. If sculpture can be described as starting with a block and whittling away anything that doesn't "feel" like the thing you're trying to create, then David has done something similar to the ZX81's tiny memory. It's hard to believe that there's a single byte left in the program that doesn't have some element of “chessness” to it.

Of course, to fit the greatest game ever into such a small space necessitated certain limitations. The program always plays as white and only makes one of two opening moves, depending which side of the cassette was used to load the game... king's pawn to king's pawn three (van't Kruijs' Opening), or queen's pawn to queen's pawn three (Miese's Opening).

The artificial intelligence of 1K ZX Chess could only look one move in advance, and the program had no concept of the newer rules of the game (ie, after the sixteenth century) such as castling, en passant, and promotion of pawns. Nevertheless, within these 672 bytes of code lie the barest bones of chess, as if this is the absolute zero of chess and below this it cannot exist in any recognisable form.

Playing the game isn't that satisfying, as it has a fondness for moving the rook back and forth between a1 and a2. If you want to break this cycle then you have to attack the square a2, and only then does it turn its attention to other things. So it's possible for it to play a good game, but only if the human opponent acts as a kind of sheepdog, guiding it towards the right move. Or at least away from a really wrong one.

If it takes one monkey seventy thousand years to type “TOBEORNOTTOBE”, then how long before 1K ZX Chess accidentally plays like a grandmaster? Having no memory of the previous game to learn from, it would be a fleeting success, never to be seen again but is there at least the potential for this game to mimic the style of every master who ever studied the game? I hope so. In one game, it suddenly pushed its queen into the fray in what seemed like a very bold and romantic move. It didn't last, though, but for a moment I felt like Prof Higgins in My Fair Lady, and I wanted to call out “By George, I think it's got it!”

(Oh, and here's a blog post in which 1K ZX Chess goes up against a newcomer to the 1K chess world, Tiny Chess.)

Tuesday 8 March 2011

The Speech Puppet

Wolfgang von Kempelen (1734-1804) is perhaps best known as the designer of The Turk, an automated chess-playing machine which amazed the wealthy and the wise in late 1700s Europe. It was a fake, but nevertheless brought him a lot of fame during his life.

More impressively, he invented a machine that could speak. He began working on it in 1769, and slowly perfected it over time. Charles Dickens wrote about it (in 1870, so probably working from second-hand sources)

“Having combined the results of his researches, he constructed a head which contained the requisite wind-tubes and vibrating reeds, and a bust provided with some kind of bellows. Thus armed, his automaton could pronounce the words “opera,” “astronomy,” “Constantinople,” “vous etes mon amie,” “je vous aime de tout mon coeur,” “Leopoldus secundus,” and “Romanum imperator semper Augustus.” These words were spoken when the machine was wound up, without any player being required to press upon keys and pedals.”

A more contemporary source (although I forgot to note the source) records:

“When Widisch heard the device he said it answered ‘clearly and distinctly’ in a ‘sweet and agreeable voice,’ but that it pronounced the letter r ‘lispingly and with a certain harshness.’ He added, ‘When its answer is not perfectly understood, it repeats it slower, and if required to speak a third time, it repeats it again, but with a tone of impatience and vexation’.”

(A nice example of how people can read emotions into inanimate objects, by the way.)

These days, it seems that a full working model of Kempelen’s machine doesn’t exist, although on YouTube there is a reconstruction which needs to be manipulated by hand for it to work. It says little more than “mama” and “papa”, but perhaps given time and a little practice, some of Kemplelen’s lessons could be re-learnt and some dexterous operator could make the machine speak again.