Live data from Hacker News

David Horne's 1K Chess on the ZX81 (2001)

thad.frogley.info

101–110 of 154 posts

Re: David Horne's 1K Chess on the ZX81 (2001)

#101
In homage to things like this, there are a number of 512 byte, 1k, etc. game development competitions. You can find them allover for a variety of machines. If you're interested these tiny masterpieces, you should enter a competition, or at least check them out.

Years ago I made a 512 byte maze game, I put up the listing here: http://burninghorizon.com/pub/c64/tinyrinth/tinyrinth.htm

I made that page before I ever saw the article (and much later webpage) describing this 1k chess program. The article should enlighten anyone who isn't sure just how small 1k of code actually is: http://users.ox.ac.uk/~uzdm0006/scans/1kchess/

Re: David Horne's 1K Chess on the ZX81 (2001)

#102

Earlier quoted context omitted.

I strongly recommend playing with this sort of machine. It's an utter education. It will, literally, change the way you think about programming. Also, the ZX81 had the best cover art for any programming manual EVER: http://uknet.com/gallery2/d/16341-2/076_Sinclair_ZX81_Manual... (Paintings by John Harris. He sells prints! http://www.alisoneldred.com/thumbsJohnHarris-Prints-3-1.html ) However, you will be frustrated w…

How did BASIC work with just 1k of memory? A scripting language interpreter is quite complex, not?

The BASIC resided in ROM. Here is a complete listing of the ROM: http://www.wearmouth.demon.co.uk/zx81.htm

Re: David Horne's 1K Chess on the ZX81 (2001)

#103

Earlier quoted context omitted.

I strongly recommend playing with this sort of machine. It's an utter education. It will, literally, change the way you think about programming. Also, the ZX81 had the best cover art for any programming manual EVER: http://uknet.com/gallery2/d/16341-2/076_Sinclair_ZX81_Manual... (Paintings by John Harris. He sells prints! http://www.alisoneldred.com/thumbsJohnHarris-Prints-3-1.html ) However, you will be frustrated w…

How did BASIC work with just 1k of memory? A scripting language interpreter is quite complex, not?

They didn't work like modern interpreters, which basically compile the program into bytecode and then interpret the bytecode. They would do simple very simple parsing of the program, mostly just tokenising it, and then more or less execute each Basic statement directly. (Sinclair Basic's wacky keyword-at-a-time entry system meant they didn't need to ship a tokeniser.)

So:

10 LET I = 10

20 LET I = I + 1

30 GOTO 10

The program counter would point at the start of line 10; the interpreter would see LET (mandatory in Sinclair Basic) and know a variable name was next; it'd read that; it'd read the equals sign; then it would read the expression and evaluate it on the fly. Then the program counter would be pointing at the end of line 10, so it just advances over the line number, and it's ready for line 20. etc, etc.

Line 30 would read the GOTO, then read the line number, then reset the program counter to the beginning of the program and scan through looking at line number headers until it found the right one. Yes, O(n). Yes, you put most used subroutines at the beginning of the program for speed.

So the entire run-time state is a program counter, a couple of fixed-size stacks for FOR...NEXT and GOSUB...RETURN, and your variables. I've no idea how Sinclair Basic stored them, but BBC Basic used a hash table that was immediately after the end of your program. Strings were a problem because they could change size; Commodore Basic had the world's slowest garbage collector. BBC Basic just fragmented and ran out of space. I don't know how Sinclair Basic handled it.

If you're interested, the entire ROM is disassembled here: http://www.wearmouth.demon.co.uk/zx81.htm

Re: David Horne's 1K Chess on the ZX81 (2001)

#105
And here are the rules that formed the core of the AI (in case you missed them):

Score provides a move score based on the following: first, the "To" position results in taking of a piece. Second, the "From" position is attacked. Third, the "To" position is attacked. Fourth, "To" enables the computer to obtain a check and finally the "From" position is defended.

Re: David Horne's 1K Chess on the ZX81 (2001)

#106
post #86

Earlier quoted context omitted.

The entire point of computers is to be able to do work that would be too tedious for humans. Really? News to me. Like the entire point of cars is to take you on journeys that would be too tedious to walk?

No, that's absolutely true. The first computers were for calculating logarithm tables, which were incredibly tedious, slow and error prone for humans to do. If you're ever in Bletchley Park in the United Kingdom, go visit the National Museum of Computing. They'll show you (and you'll get to play with) the Harwell Witch, a decimal computer designed to compete with humans who are using mechanical hand-cranked calculato…

Not seeing where you're arguing that the entire-point of computers is to do tedious calculations.

That the first computers were used that way, I don't doubt. But not the same thing, I'd say. The first cars were horseless carriages.

Re: David Horne's 1K Chess on the ZX81 (2001)

#107
post #94
post #85

Earlier quoted context omitted.

Nope sorry. Do you see why your explanation is poor?

I can't imagine being like you, so please understand how weird it must be for me to watch someone be so dedicated to being wrong.

please understand how weird it must be for me to watch someone be so dedicated to being wrong

I sympathise, I'm having very much the same experience.

Re: David Horne's 1K Chess on the ZX81 (2001)

#108
post #86

Earlier quoted context omitted.

The entire point of computers is to be able to do work that would be too tedious for humans. Really? News to me. Like the entire point of cars is to take you on journeys that would be too tedious to walk?

No, that's absolutely true. The first computers were for calculating logarithm tables, which were incredibly tedious, slow and error prone for humans to do. If you're ever in Bletchley Park in the United Kingdom, go visit the National Museum of Computing. They'll show you (and you'll get to play with) the Harwell Witch, a decimal computer designed to compete with humans who are using mechanical hand-cranked calculato…

I do want to second the sentiment that a visit to Bletchley Park is a very good use of an afternoon!

Re: David Horne's 1K Chess on the ZX81 (2001)

#109
This is the opposite of a great program.

A great program scales with Moore's Law: when you get 2x memory, the program gets better, ideally more than 2x better.

Human limitations remain constant through the ages, that's why climbing Mt. Everest or the 4 minute mile are so compelling. But the most basic fact about computing capacity is its (exponential) upward trend.

Re: David Horne's 1K Chess on the ZX81 (2001)

#110
post #106

Earlier quoted context omitted.

No, that's absolutely true. The first computers were for calculating logarithm tables, which were incredibly tedious, slow and error prone for humans to do. If you're ever in Bletchley Park in the United Kingdom, go visit the National Museum of Computing. They'll show you (and you'll get to play with) the Harwell Witch, a decimal computer designed to compete with humans who are using mechanical hand-cranked calculato…

Not seeing where you're arguing that the entire-point of computers is to do tedious calculations. That the first computers were used that way, I don't doubt. But not the same thing, I'd say. The first cars were horseless carriages.

don't be pedantic
Post reply on HN