The greatest program ever written
kuro5hin.org
kuro5hin.org
the 1k is aided and abetted by the architecture of the computer.
* Reading keyboard is reading a register/known address, not loading the keyboard library, allocating a structure and jumping into an OS routine.
* Clear screen is writing zeros to a known address space
* Drawing is writing a 1 to a known address space
* Yours is the only process on the machine
* Text compresses well with Huffman
With those assumptions a lot more can fit in the 1K
Reading keyboard is reading a register/known address, not loading the keyboard library, allocating a structure and jumping into an OS routine
Or calling a ROM routine. Reading the keyboard directly at the lowest level would probably just make the program bigger
Clear screen is writing zeros to a known address space
Generally, another ROM routine call.
Drawing is writing a 1 to a known address space
Not really. Just about all these machines had color. The Apple ][ had a fun non-linear video buffer layout, to boot.
Text compresses well with Huffman
Not a lot of text in a chess program.
ROM routines is a jump into known addresses... so no extra impact on the 1K. Parameters are read from registers.
Color of 4bit? only a slight increase. Often acheivable in 1 instruction. Limit of 2 colors in 8x8 block on ZX81[1]
--------------------
6502 was my platform, so I missed the exact Z* platform...
I was sharing general info on assembly for 8bit, not specific to one platform (ZX81). This seems to have incensed some people who took a narrow view on what sort of comment was permitted.
The ZX81 did not have colors.
Generally, another ROM routine call.
Thats @tezza's point. (Edit For Clarity): Since its just one instruction, you can shrink the size of your program, making fitting it into a small space less impressive (though, not unimpressive).
Not a lot of text in a chess program.
Fair enough, so that one doesn't help, but the other two do.
For reference to my original post: I wasn't trying to deny that this program is amazing... it is.
I was intending to illustrate that you could do a lot more with 1k historically than you can nowadays, and that some of the worst offenders to bulking out a process don't apply on older computers in assembly.
That doesn't take away from the brilliance of AI in 1k, but rather I think the focus should be on that and not the chessy bit.
1) Reading keyboard input and clearing the screen can both be executed via a ROM command.
2) Doing these things otherwise would have made the program bigger.
Am I right that we agree on these? If so, I don't see how you don't agree that:
3) Having both of these as ROM commands helps make the program smaller.
As far as I can tell, we agree on these 3 points. You, however, seem to be bringing up a few more points:
4) Instructions are short.
5) Alignment is on the byte.
...
And, from what I can tell, you are saying that these were more helpful in reducing the size of the program. Am I right so far?
If so, you maybe right that compared to modern computers, but that doesn't mean that @tezza is wrong that the other factors helped.
Also, I believe its already been agreed that Huffman encoding doesn't help...
Going back to the N = 5 things. Three seem to help, two don't.
The helpful ones:
* Reading keyboard is reading a register/known address, not loading the keyboard library, allocating a structure and jumping into an OS routine. *
Doens't this make make the program smaller? Getting the key entered is just a read instruction. Sure, there maybe things that happen afterwards (as you said) but just getting the key is one instruction i.e. read <some memory spot>
* Clear screen is writing zeros to a known address space *
Again, instead of doing a number of instructions to clear the screen (I have no idea how many this takes on a modern computer) you just need to write do write 0 <memory location>
* Drawing is writing a 1 to a known address space *
My understanding is that on modern computers this is a complex operation. But, in this it appears that drawing is again a single operation.
In each case, the point @tezza is making is: Hey, all you people who haven't ever used these crazy old machines, these are the types of things that make it easier to create a very small chess program (in terms of size of the program itself, not the resources it uses). All these things that nowadays require a lot of instructions only required a single instruction on this machine.
The other two points, I agree, are probably not helpful.
Using the keyboard reading as an example, it seems whoever designed this machine said "one way to reduce the size of programs is to make it easy to read keyboard inputs. Lets have the hardeware store that in a known address." Thus, the fact that you can do this does help reduce the size of the program.
Am I wrong? Let me know. I've never worked on these machines so I could be completely off base. A friend of mine used to wonder if it would be instructive to learn about programming under these limitations so I'm genuinly curious.
Note: I'm not objecting to your points about what reduced the size of the program. I'm just trying to figure out why you think @tezza's points don't help.
8bit coding was very different. I listed some common tricks not necessarily specifically ZX81, nor necessarily used in this chess game, but illustrative of common scenarios.
Thus you could fit much more in 1k than you can today.
ENDE (please take a deep breath)
A high quality 3D FPS that is a mere 97,280 bytes through the magic of procedural generation.
Source code here: http://users.telenet.be/kim1-6502/microchess/microchess.html
I had the PET 2001 version (running in 7K of RAM) back in the day, and it played quite well, all things considered.
D8A2FF9AA2C886B2201F1F206A1FC5F3F0F685F3C90CD00FA21FB5709550CA10F986DCA9CCDO12C90ED00720B202A9EED007C914D00B20A20385FB85FA85F9D0BFC90FD006204B034C9D0l4C960110000304000702O50l06101711161215141373747077727571766067616662656463F0FF0l1011OFEFF1DFElEEF2120E1F210B0A0606040404O40202020202020202A6B5305
CA5B0F308EO08D004C5E6F02EF6E3C901D002F6E3501EA00FA5B1D96000
F0038810F8B9A000D5E4900494E695E4180875E595E528E004F00330316
0A5E885DDA90085B5204B0320B20220000220B202A90885B52009022031
034C8017E0F9DO0BA560C5B1D004A90085B46050FDA007A5B1D96000F00
588F0F110F6B9A000D5E2900295E2C6B5A9FBC5B5F003202503E6B560C9
08B01220EA03A21FB550C5FAF003CA10F786FB86BO4C000000A210A9009
5DECA10FBA91085B0C6B0100l60201E03A4B0A20886B6C0081041C00610
2EC004101FC00lF009100E208E02D0FBF0D9209C02DOFBF0D2A20486B62
09C02D0FBF0C7209C02A5B6C904D0F7F0BCA21086B6208E02A5B6C908D0
F7F0ADA20686B620CA025005300320000l201E03C6B6A5B6C9O5F0EB20C
A02708F308D20000lA5B129FOC920FOEE4C0D0220CA023003200001201E
03C6B66020CA02900250F930070820000l2850F0201E03C6B660A20F38B
460A977F550956094503550CA10EB60A5B1A6B618758F85B12988D042A5
B1A220CA300ED550D0F9E0103033A97F69017001B8A5B53024C90810204
808A9F985B585B4204B0320B202200902202E03286885B5A5B4300438A9
FF6018A90060A9FF18B860A6B0B55085B160204B0320B20220090220820
2BA86B3A6B29A6885B66885B0AA68955068AA6885B195504C7003BA86B3
A6B29AA5B148A8A21FD550F003CA10F9A9CC95508A48A6B0B5509450488
A48A5B648BA86B2A6B39A60A6E4E4A0D004A900F00AA6E3D006A6EEDO02
A9FFA20486B5C5FA900CF00A85FAA5B085FBA5B185F94C1F1FA6DC1017A
5F9D5DCD00FCAB5DC85FBCAB5DC85F9CA86DCD01A85DCA20C86B586FAA2
14200202A20486B5200002A6FAE00F9012A6FBB55085FA86B0A5F985B12
04B034C0000A9FF60A20406F926FACAD0F905F985F985B1600000000000
0018A98065EB65EC65ED65El65DF38E5F0E5F1E5E2E5E0E5DEE5EFE5E3B
002A9004A18694065EC65ED38E5E44A18699065DD65DD65DD65DD65El38
E5E4E5E4E5E5E5E5E5E0A6B1E033F016E034F012E022F00EE025F00AA6B
0F009B450C01010031869024C7703There you go: a fully functional Chess program, with AI.
If someone would create a prize (a prize like the netflix prize or the Hutter prize) with $100k or something, to create the smallest chess program, I suppose hundreds of contestants would fit into 1k. But the competition would be high, and the winners would be probably very sophisitcated algorithms, which might deserve the 'greatest program ever written' title. But without competition it is easy to be the best.
It is the nature of tech to build on what was done before. It's hard to remember that something that now might be laughable, was at one point considered impossible.
The subject of the article is a person who wrote a chess program. Not the first chess program. Not the first successful chess program. A chess program. Nonetheless, it is still an impressive feat to fit a chess program with AI into 1k. But it is not comparable to the Wright Brothers' airplanes.
http://users.ox.ac.uk/~uzdm0006/scans/1kchess/
And here's a ZX-81 emulator to play the actual game:
http://www.zx81stuff.org.uk/zx81/emulate.php?tzx=0%2F1KZXChe...
I'd love to find a place like K5 again. Rusty killed it with the $5 registration fee for new accounts. The dupe accounts, multiple personalities, and role playing were part of the charm.
Or is that where all the admin work came in?
Poor moderation and poor adminship killed the site. There were no (permanent) negative consequences for bad behavior, since a dupe account could just be made, and if it was banned it was no big deal. There were also no real benefits for good behavior. So after a certain critical mass of trolls and griefers assembled, they managed to drive everyone off the site from 2004-2006.
You can see the overall rise and fall of the site here: http://k5.trolltrack.com/stats.php
You can see the new users flatline when the $5 paywall was instituted.
Anyone know of anyone trying to clone it since then (on any topic)?
DailyKos is the most prominent site using Scoop to manage frontpage content and diaries. They made a host of extensions, fixes, features, and changes, but apparently didn't share anything back with the main Scoop codebase.
It's not clear anymore where one can download the Scoop sourcecode, although I think some k5 users have upped a copy somewhere.
As far as I know, k5's still one-of-a-kind. The closest copy is a site called hulver.com ("HuSi" short for "Hulver's Site"). HuSi was created by a disaffected member of the k5 community, hulver, who got fed up with the trolls. It is much more focused on diary content rather than frontpage-quality long form content. Basically, the entire British portion of k5 fled to HuSi, and they have pretty active admins there who ban the occasional visitor from k5 trying to troll. Still, it remains very small, and doesn't produce the same caliber of content that k5 once did.
That being said, it was great at its peak. Combination of a blog community, debating club and much more.
It was funny reading the article, since I recognized a few names and immediately thought, "Holy Shit, that guy's still there?"
Then I saw the date.
My first attempt at a javascript chess game was almost 7 years ago. 159 lines of javascript and html. Unfortunately, it's nothing more than a pieces-on-board sim. It doesn't do anything to control play or prevent cheating. It was college, it was fun http://members.gamedev.net/capn_midnight/chess/chess.html
E.g.: Unix, Java, Sabre, VisiCalc, Mars Rover and Hubble controlling software, etc.
Other than reducing the readability, I cannot think of any advantage offered by the mere compression of the source code.
Good times!
The Best HN Hyperbole. (For today!)