The comp.sys.sinclair Crap Games Competition 2021 - 25th edition!



Author:  Salvador Camacho Model:  16K ZX80 Format:    .O
Submission date:  5 June 2021 Documentation:  none Tested on:  EightyOne 1.23

Download it here

In the beginning, there was Noughts and Crosses. And by "the beginning", I mean the 2004 CSSCGC, in which the first ever submission for the ZX80 was by yours truly. It was my first ever attempt at a ZX80 program; I'd never owned one back in the day, I'd only ever seen pictures of it, such as on the front cover of the April-May 1983 issue of ZX Computing. But once I'd discovered emulation, only then did I find out how crippled its 4K BASIC was, even when compared to the ZX81 I'd been familiar with when I was three feet tall. All I could think to write was the above version of Noughts and Crosses in which two players input their moves and the ZX80 draws them on screen, declaring a winner when there is one. It had never crossed my mind (groan) that Sinclair's most primitive computer (bar the MK14) could play with some kind of AI...

Salvador Camacho, who has also never programmed a ZX80 until now, thinks otherwise.

What he has given us is an electronic existential crisis. Do you have an excess of self-esteem, which you want to cast aside in the most painless possible way? Play Tic Tac Toe Hell, and in mere seconds you can suffer the embarrassment and indignity of being beaten at a game that small children can play - every time - by a computer with a reputation as being thicker than one short plank.

But you can partially rescue yourself by knowing that the computer is programmed to cheat. After the title screen - which has badly-spaced text so beloved of CSSCGC entries in days of yore - you'll see an excellently-presented screen, on which the ZX80 has placed its first cross in the centre square. This it will do every time, without fail. What you should do is familiarise yourself with the tactics of the game, and to your immense dismay, I quote: "It's possible to win by playing second, but your opponent will have to make a big mistake." And the ZX80 is programmed not to - it will play a perfect game. But still, don't get ideas above your station, human beings! Your next move, should you wish to force a draw, should be to put your "O" into one of the corner squares - whereupon, the ZX80 will distract you. "Look behind you, a three-headed monkey!" it says. And when you're done looking behind you and seeing that the monkey isn't one of Dr. Alphonse Mephesto's experiments, the ZX80 has fraudulently moved your "O" into an edge square, from which you have no choice but to lose.

Behind this obvious piece of trolling is a very well-presented program that shows what the ZX80 can do when programmed in machine code, even without Paul Farrow's level 60 wizardry that defeats its flickering screen. Admittedly, just like Zhunder Vlade, it was written in C and compiled with Z88DK, and would have been an absolute nightmare to program back in the day. It doesn't qualify for the Blue Challenge as it's 6,532 bytes and that challenge is limited to the 1K ZX80, but it's a sterling effort nonetheless. Technically, it shouldn't qualify for the White Challenge either because Salvador's actual first attempt at a ZX80 program was Zhunder Vlade compiled for the ZX80, but the flickering screen made it unplayable. So I'm going to allow this for the White Challenge on the grounds that it's his first attempt that actually works. And, with a few modifications to the C code, it could be turned into a version of AI-based Noughts and Crosses in which the computer doesn't cheat - although it would need to have a player-victory routine written, because I've looked through the code and it isn't there!

I barely know any C but even from a look through the code, which Salvador has helpfully provided, there's a custom printAt() function in there, which overcomes the ZX80's lack of both AT and TAB in BASIC. The function zx_setcursorpos that it calls, I assume is part of Z88DK, which I'm completely unfamiliar with, but the fact that it exists and this program works is proof that it is possible to print a character at a specific point on the screen on a ZX80. 41 years after its launch and 17 years after I wrote my first ZX80 program, I'd never worked that out. It must be a POKE to a system variable (probably 16420 and 16421, looking at the manual, even though they're marked "do not POKE"). Why didn't I think of that before? See, there's always more to learn, no matter how old you are and how obsolete the computer is. Even so, let's not kid ourselves that this is anything other than a two-mask game, because there's barely any game in it, unless you're a glutton for punishment, or a masochist, which I'm not. I'll give it four Ricks for effort, though, for its presentation, meeting a Challenge, and for inspiring me to make my own ZX80 programs better. I might even have an attempt at my own Blue Challenge, so next year's host... brace yourself!