26 comments

[ 3.4 ms ] story [ 58.3 ms ] thread
Ah, the ZX81, my first computer.

Those Halcyon days of typing in lines and lines of code...

Only to be met with a sudden crash due to the 16K (16K!) RAM pack ever so slightly shifting, interrupting the flow of electrons on the edge connector on one or more signal lines ;)

Good times!

mine was zx82! Loved it!! mine used to overheat for some reason, the heatsink on the top right side ...loved those games too.
Was there actually a ZX82? It's my understanding the ZX82 was the code name for the ZX Spectrum but it was never released under the moniker of the ZX82. There was certainly a ZX80 as well as the ZX81.
My first computer too. Stuck a match in with the RAM pack, along with a bit of Blu-tack to keep it all together. Stunning memories of typing programs in KNOWING they'd be zapped once I pulled the power. Funny thing was we had no TV until we got the ZX81. I spent two weeks with the user manual and no TV: for a long time after that I was irritated by people who didn't RTFM in advance. It still worked last time I tried it. RAM pack'n'all. Very much a treasured possession.
My first computer too. I remember I managed to create a Frogger like game in ascii art, before turning off the computer and deleting the game for ever.
Yeah... That was my first computer.

1k of RAM, up to 768 bytes of used for character display memory (less of you only use the top, left corner of the screen). About 130 bytes for system variables.

The CPU was responsible for generating the TV signal, so you got it only in the vertical blanks when no signal needed to be generated. Hence you had a "fast" move where you only see noise on the screen.

I loved that thing.

"... Yeah... That was my first computer. ..."

Same here, though upgraded mine from an '80 [0] Occasionally I get the urge to fire it up and type in some code, but it gets hot and starts to smell.

Syntax checking as you type :)

[0] https://www.flickr.com/photos/bootload/tags/zx81

mine was a ZX Spectrum 48k - have had a gazillion devices since that, but it was never the same. One of the fondest memoeries whas drawing my sprites on grid paper and then getting them to animate while pressing the keyboard..

miss those days...

Here's an interesting question for you:

Your goal is to implement full Chess in the smallest number of bytes. However, you're allowed to design your own instruction set to accomplish this. The instruction set must be Turing complete.

Given this, what's the smallest Chess program possible? Is there an ultimate limit, information-theory style?

I know there's no easy answer or perhaps no answer at all. Maybe it's an NP-complete problem whose best answer can only be approximated or brute forced. But it's still really interesting to think like, if you toss aside all of the normal constraints, what's the smallest chess program that anyone can make?

Bonus points if you dive into experimental instruction sets like imprecise computing or quantum computing, though I doubt those things could help implement a precise rigid ruleset like Chess.

I'll define an instruction set with a single instruction CHESS that when executed will play a game of chess with the user.

I'm sorry, I know this is a bit of a "snarky" type reply, but I don't really understand what you are driving at with your question. Without more constraints on the question, there's not really any point in searching for the minimum solution.

> The instruction set must be Turing complete.
I don't quite see how this requirement changes anything. You could have a full Turing complete instruction set, and still have a CHESS instruction that plays a game of chess with the user. The "Chess program" would still be 1 instruction.
Well, an instruction set is said to be Turing complete if it can be used to simulate any Turing machine. A single instruction can't, so if you design an instruction set to implement Chess and then don't use it, that's not really the point of the question.

Any ideas about how to better specify the rules of the competition to exclude degenerate answers like the one you provided? The goal is to answer the interesting question. You'd never find such a high-level instruction in a real instruction set, because it wouldn't be useful except to play Chess.

I'd add a rule like "The goal of your instruction set is to be useful while still implementing Chess," but then that would exclude answers which give interesting instruction sets that aren't necessarily useful except in implementing Chess in the fewest possible bytes.

Thanks for pointing out the flaws in my ruleset. I've been toying around with creating a blogpost about this, so having a bulletproof ruleset or at least one that isn't so easily sidestepped would be great.

> Well, an instruction set is said to be Turing complete if it can be used to simulate any Turing machine. A single instruction can't

Incorrect. A single instruction can be Turing complete.

http://en.wikipedia.org/wiki/One_instruction_set_computer

Though the relevant question is whether universal computation can be built on the back of an instruction which plays chess rather than one of the more typical bases for a OISC.

This is awesome. Thank you.

What are some typical bases for OSIC?

> Though the relevant question is whether universal computation can be built on the back of an instruction which plays chess rather than one of the more typical bases for a OISC.

Well you can have two instructions: SUBLEQ and CHESS. Then it's Turing-complete, and there's a one-bit program that plays chess.

The instruction set has to exclusively contain instructions necessary to achieve the Turing-completeness. That excludes most of x86 etc. etc. Size-coding is all about restrictions. OTOH, if you could find that the CHESS instruction is Turing-complete, that would be a feat.
(comment deleted)
Specify the problem in terms of logic gates. You can spend gates building special-purpose ALUs, you can sink everything into RAM/ROM and have a complex program written in an extremely simple RISC instruction set or strike any balance between. Going with gates instead of transistors keeps things tidy and not tied to any particular strategy for physically building the system.
How well does it need to play? You could just do random moves withinh the allowed rules.
Sure, that's fine. It's not about making an AI but rather implementing chess.
It's not full chess without castling, promotion, and en passant capture.
True, castling is essential, but for a decent chess playing experience, promotion to anything except a queen is not really necessary, and en passant is too obscure to be relevant.
Underpromotion happens in tournament chess, and en passant is fundamental. Without it it's a different game as pawn blockades work differently.
Totally takes me back. I remember programming a 1K space invaders game. I always wished I could get the 16K Ram Pack but did not have the money so made do with the 1K !!
Wow, that takes me back. The ZX81 was my first computer followed by a ZX Spectrum. I was browsing through the adverts and saw a couple of familiar ones, including the "50 Games £9.95".

I recall buying that and £9.95 was a lot of money. It was one of the most disappointing purchases of my life. The games were TERRIBLE. Absolutely awful, even by 1983 standards. They were basically of the standard of the games that you could type in for free from magazines such as Your Computer and Sinclair User.

You owe me a tenner, Cascade Software!