(Because I didn’t have enough projects going on at once…)

Basically, I’ve been working out of my book for about two weeks now, and I’ve written very little code. That bugs me. But I can’t really start on Planitia yet, can I?

So I began to think about doing a little game on the side in the meantime. A very little game – one that would scratch my game development itch but not take a bunch of time away from the book.

And then I remembered a little something I read in The Rainbow back in high school.

The Rainbow was a magazine for the Color Computer, which was Radio Shack’s competitor for the Apple II/Commodore 64/Timex Sinclair 1000 market. The Color Computer ran on a Motorola 6809 processor and came with 4k of RAM (later models came with 16k and there were expansion systems designed to bump it up to the “magic” 64k). It was hampered a bit by its weak display system, but overall it was a good little computer and lots of hobbyists used it for lots of different things.

And of course support magazines sprung up for it. The Rainbow was the biggest and most successful of these, and it was an old-school support magazine in that it included source listings that users could type in themselves. It covered just about every application you could put a computer to, which included games. Indeed, their annual game issue was always their biggest seller. During its heyday issues of The Rainbow ran over 300 pages and looked like phone books because of all the included source code.

I read a whole bunch of issues in high school. I borrowed them from a friend and thoroughly enjoyed them despite not having a Color Computer of my own. (Back then I would read anything about computers I could get my hands on.) And I recalled reading a small article in one issue that presented a version of Centipede a reader had written and submitted. This game was unique because the source code only took up a little more than one page. I remembered being very impressed when I saw that.

And I decided that writing a complete game in one page of source would be a unique challenge that wouldn’t take too much time away from learning DirectX.

So here comes a new challenger!

The One-Page Game

What does it mean to write a game in one page? Well, after trying it myself and having some of my friends try it, we’ve come up with a couple different interpretations.

Challenge 1: The True One-Page Game

To complete this challenge, write a game whose source is fully contained in one page of text that is eighty characters wide and sixty lines long. No external data files are permitted; this source file must contain everything your game needs to run. You may only use the base libraries that come with your compiler.

Of course, in order to complete this challenge, you’ll have to write source code that looks like this:

#include <windows.h>
HANDLE h;SetCur(bool b){CONSOLE_CURSOR_INFO c = {1, b};SetConsoleCursorInfo(h,
&c);}Init(){h = GetStdHandle(STD_OUTPUT_HANDLE);SetCur(false);}SetPos(int x,
int y){COORD c = {x, y};SetConsoleCursorPosition(h,c);}SetColor(int f, int b){
SetConsoleTextAttribute(h,f|b);}Print(char* i){DWORD r;WriteConsole(h,i,
strlen(i),&r,NULL);}

If this bothers you, you can try Challenge 2.

Challenge 2: The 4800-Byte Game

To complete this challenge, write a game whose source is fully contained in one file that does not exceed 4800 bytes in length. The actual file can be as long as you want it. While you may think you’re getting a little extra room with this method, I think with the extra whitespace it’s a wash, so this is mostly an aesthetic decision. Again, no data files or libraries except what came with your compiler.

And if that just isn’t enough room for you (or you abhor writing text-based games) you can try Challenge 3.

Challenge 3: The Two-File Game

To complete this challenge, write a game whose source is fully contained in two files, one header and one source, which are less than 4800 bytes each (9600 bytes total). Again, no data files or libraries except what comes with your compiler, but under Windows this includes DirectX and D3DX so this version opens up the option of using 3D rather than making a text-based game. Tom has already created an incredible-looking game that fits this challenge. Hopefully he’ll post it soon.

As for me, my game will fulfill Challenge 1. It’s going to be a Centipede clone in honor of that article I read in The Rainbow. And it would be done by now if I hadn’t spent so much time figuring out how to get the mouse to work with a console application…