Sunday, January 14, 2007

ZX Spectrum and Scrabble Nostalgia

I've been prompted to delve back into my teenage years by a surprising article in the February issue of PC Pro which urges us to 'Forget 3D games, says Dick Pountain, it's Scrabble that PCs really need to get to grips with.'

From an early age I had a penchant for words and numbers, their calculation and manipulation. This manifested in several ways during my time at secondary school: I became keen on Scrabble and I started teaching myself to program computers.

Like many of my generation, I owe my first steps to Sir Clive Sinclair: initially, I started with a Sinclair ZX81, which my parents kindly bought for me for Christmas. With 1K of RAM, I was limited in what I could develop, though I was able to validate UK VAT registration numbers! Nevertheless, it was enough to introduce me to a new world and I could write my first programs - in Sinclair's implementation of BASIC. Within a year, there was another breakthrough with the ZX Spectrum and soon after I persuaded my parents again to invest in this new toy that boasted 16K RAM, 16 colours, sound and a wider range of software titles.

I then made a concerted effort to produce a Scrabble program, where the computer could act as one of the players. Whereas previously I had been content to write everything in BASIC, in this instance, I learnt sufficient Z80 machine code to be able to convert the main 'thinking' algorithms. Result: the computer responded in a few seconds rather than a couple of minutes!

It can be quite a work of art to cram as much as you can into the 16K. The computer had a 500 word vocabulary and included an algorithm for ensuring it played the highest scoring move, but generally it wasn't a strong opponent. In actuality, 7K was devoted to the screen display, which can be set as part of the procedure to load the program. Normally, that leaves you with just 9K, but I allotted this space to display a detailed logo in one section and a simple blocky 'Welcome' title in another, which 'hid' about 2K of instructions, which could be read as a scrolling message along the bottom of the screen. Once the game had started, though, the who screen display was refreshed, so these instructions could not be revisited unless the game was reloaded.

Having played Scrabble competitively, I wanted to see the development of a version that was much more competitive. After a while, there was a highly polished product, Psion Scrabble. I wrote to them in the beginning of '86 and described tactics that could enhance the software. Three months later I received a kind response thanking me for the ideas and wishing me well in my 'A' levels, but the overall message was that Psion was going to concentrate on the development of its hardware products. (Perhaps I should have bought some shares?!)

I stopped development of the code around that time, but retained some interest in how tactics could be encoded. About 10 years later, I happened to come across a journal article by Steven Gordon concerning Scrabble algorithms. I corresponded a little by email and learnt that he had implemented a number of similar ideas, but I think far more systematically! So he's probably a good contact for Mr. Pountain.

Over 20 years later...

I've come across an old cassette tape with a copy of the program on it and having invested in an external sound card to digitise these tapes , I decided to undertake a conversion. After some fiddling, I worked out the right settings and the process works fine - the Creative Player is able to sample at the right frequency and bits and I used MakeTZX to convert into a tape archive format.

If you're curious in seeing the program (and don't have high expectations!) you are welcome to download a copy, available as a zip package. When you've unzipped the package, you will see a number of files, with a readme and instructions. Look through those and then launch the .tzx file in an emulator — I've found emuZwin works very well on a PC.

A little modernisation of my blog

I've just upgraded to the new version of Blogger, which should provide a number of benefits, particularly with its integration with other Google services. And I expect the interface will become more usable and sophisticated.

I blog about a wide range of things, so have been pleased to see the labels feature and have duly added labels, which now appear under each post. However, it's only a step and if I am to post a series of entries on a new topic of interest to a minority of readers, I may still set up another blog, as I did for a particular interest in handheld computing. Anyone who comes back to read the blog may be put off by a topic that's not of interest to them; similarly for someone who has subscribed to a newsfeed. Hence one of my outstanding requirements is the support for newsfeeds according to categories, which is provided neatly by other systems such as Pebble, which I used at my workplace to issue news on updates to a specialist piece of software. However, I can't yet find such a facility with this system...

Even so, Blogger's update is welcome!