7 ms·
Chess game in 487 bytes – new record
- Chronic30 12y agoHow is this going to impact my daily life?
- fcambus 12y agoNice to see this appear on HN! For info the author also released an impressive serie of very tiny intros ranging from 64 to 256 bytes which can be found on his personal site : http://olivier.poudade.free.fr http://olivier.poudade.free.fr
- morcheeba 12y agoSource code: http://olivier.poudade.free.fr/src/BootChess.asm http://olivier.poudade.free.fr/src/BootChess.asm
- rwmj 12y agoI'm glad they mentioned 1K chess for the ZX81 [1] which I remember typing in from a magazine listing, and then playing against quite a lot (it was better than a 10 year old me). Neither program is capable of castling. [1] http://users.ox.ac.uk/~uzdm0006/scans/1kchess/ http://users.ox.ac.uk/~uzdm0006/scans/1kchess/
- ikeboy 12y agoIf they can't castle then they aren't complete. Or do you mean the ai can't castle, but you can?
- rwmj 12y agoThe ZX Chess AI could not castle. It wasn't possible to enter a castling move for the human player either. Also looking at the Wikipedia page I see it didn't understand "en passant" or queening either, so it plays a reduced version of chess.
- ikeboy 12y agoI've got an even shorter program that plays a more reduced version of chess. It's 0 bytes.
- treve 12y agoWhich subset?
- ikeboy 12y agoThe empty subset. The title claims it can play chess, this is not chess.
- mikeash 12y agoHow small can you make a program that makes pedantic, technically correct, but completely useless comments on the internet?
- ikeboy 12y agohttps://xkcd.com/810/ https://xkcd.com/810/ I think that problem requires at least as much space as the brain module that determines "usefulness", which means quite a lot of space.
- pedantbot1k 12y agoDepends on how you define "pedantic".
- mikeash 12y agoNice answer (and username).
- ctdonath 12y agoIt was a ZX81. "It's not a complete implementation" was presumed for anything running on that tiny thing. The base model had 1K RAM, which included all video & OS memory space. Getting it to do anything meaningful was a challenge. That somebody, back then, could get a sane implementation closely approximating chess running on it was amazing.
- david-given 12y ago1K Chess for the ZX81 was 672 bytes long; the ZX81 had 672 bytes free. (Although it was more complicated than that because the ZX81 'framebuffer' changed size depending on what was on the screen, so a screen that was mostly white gave you more spare RAM.) Also, because the ZX81 more-or-less did its video in software (again, it's more complicated than that; if you really want to know, you'll need a strong stomach. Let's just say that it hinged on abusing the Z80's built in DRAM refresh and the framebuffer was executable), which meant that the only time you could do processing with the screen turned on when it wasn't doing video. And the video took 75% of the run time. The ZX81 was less a computer and more of a pile of hacks flying in close formation. The fact it ran at all was a miracle.
- rwmj 12y agoHow the ZX81 display file worked: http://www.user.dccnet.com/wrigter/index_files/ZX%20Video%20Tutorial.htm http://www.user.dccnet.com/wrigter/index_files/ZX%20Video%20... Note the encoding of that page causes it to render incorrectly at least in Firefox. Using View → Character Encoding → Western fixes that for me.
- marvy 12y ago"Hacks flying in close formation" made my day :) Thank you for that lovely phrase.
- fuzzywalrus 12y agoCouldn't get the OS X binary to mount and I'll have to fire up a VM to try a different binary. However there is a nice txt file, Bootchess.txt that has some interesting excerpts. I was curious if it has an AI, to which it does: " Usually the heart of any midly advanced computer chess games includes a MinMax function (or its unique call merging sister function NegaMax) called recursively evaluating both sides' possible moves and trying to minimize loss whilst maximizing captures : each evaluation pair rundown is called a "ply" in chess jargon. It can take Kasparov some 27 moves to battle a 3-ply and the champion programs competing with grandmasters usually have at least 5-ply. In the case of BootChess there is alas not enough space (512 bytes binary program size and 640 bytes RAM execution environment) for such level of sophistication. It uses a variant : while maximizing captures it tries to minimize the taxi/Manhattan distance to the opponent's black king rank. This weaker ai element combination will be named "TaxiMax" for the occasion and can be viewed as a half-ply plus."
- Impossible 12y agoIn the readme file (BootChess.txt) He quotes a great HN comment thread (https://news.ycombinator.com/item?id=7940938 https://news.ycombinator.com/item?id=7940938) from (https://news.ycombinator.com/item?id=7940212 https://news.ycombinator.com/item?id=7940212), a 128 byte raycaster written by the same author. The title of that section is "Proving know-how remains valued". This post has already generated some similar gems like this one (https://news.ycombinator.com/item?id=8954853 https://news.ycombinator.com/item?id=8954853).
- deleted 12y ago[deleted]
- ehamberg 12y agoThe README file is really interesting: http://lpaste.net/119343 http://lpaste.net/119343
- mattdotc 12y agoIf you enjoyed that README, you might also like Jason Scott's talks. See this one about the history of early pirates in the BBS days: https://www.youtube.com/watch?v=a5AceLYWE1Q https://www.youtube.com/watch?v=a5AceLYWE1Q
- ehamberg 12y agoThanks! Looks interesting. :-)
- mikeryan 12y agoThe README is 128 times larger than the program...
- RIMR 12y agoYeah, well this guy can launch a GUI in zero bytes! Beat that! http://www.pouet.net/prod.php?which=18860 http://www.pouet.net/prod.php?which=18860
- ctdonath 12y agoFor interesting contrast: Toledo Nanochess http://www.nanochess.org/chess3.html http://www.nanochess.org/chess3.html is the smallest C implementation of a full & decent chess program.
- not_kurt_godel 12y agoIt's not chess if it doesn't allow castle. From the comments (http://www.pouet.net/prod.php?which=64962#c715279 http://www.pouet.net/prod.php?which=64962#c715279): > Well... It is clear to me that you put more interest in making a small chess program that in making a good chess program. That's understandable even if the result is a program very easy to beat but... you cannot say that BootChess is a complete chess program because it does not allow to castle (didn't tried promotions, underpromotions, en passant pawn captures, stalemate... but I bet that are not supported, are they?) and, worst, it does not care about avoid to place a King in check. Every chess player knows that it is illegal (the movement CANNOT be made) to place your king on a square controlled by your rival pieces. If you allow it, then this is not chess.
- raverbashing 12y ago" It is clear to me that you put more interest in making a small chess program that in making a good chess program" That's pretty much obvious It's an exercise in programming, it's not "the ultimate chess software"
- libria 12y ago"Chess program" has to be defined in a way the general audience can agree to. Many people could also code a non-chess implementation in much less than 487 bytes and call it chess. It still looks like an impressive exercise, but any talk of broken records demands widely accepted set of rules that have been met.
- girvo 12y agoNot when the predecessor also doesn't meet those rules.
- not_kurt_godel 12y agoThe obvious interpretation of "good" in that sentence is that it would allow the player to play chess according to universally defined and agreed-upon rules. Castling is one such rule. While I think one could argue there is some leeway with allowing the king to move into check since it doesn't prevent 2 players familiar with the rules from playing a valid game, inability to castle does not pass this litmus test. Castling is integral to the game and is neither obscure nor rarely invoked, even at the novice level - a game without it is simply not "chess". While I agree this is an impressive programming exercise and worthy of recognition in its own right, calling it a "new record" is like claiming a marathon record after running 25 miles
- jpwagner 12y agoreminds me of the runner-up in the first js1k competition (even better): http://js1k.com/2010-first/demo/750 http://js1k.com/2010-first/demo/750
- fsiefken 12y agoThat would include 1) rules for the movement 6 chess pieces 2) board definition and initial setup 3) end conditions 4) exceptions. A tweets lenght worth of each, neat.
- firethief 12y ago"Exceptions"??
- rinjipal 12y agoOh ! and this one is a PC boot sector. Sexy
- darkmighty 12y agoWith such a small number of bytes wouldn't it be viable to run some sort of optimization to minimize the code even further?
- tluyben2 12y agoVery nice to see that the RSi guys (who I have been a fan of since the begin 90s; especially the Amiga stuff was very impressive, both in skill but also art) still take challenges like this one. Disadvantage here is that whenever I click a Pouet.net link, I can pretty much say farewell to my productive day...
- aaron695 12y agoDoes it run on a ZX81? If not I'd guess it might be using short cuts not available on the original machine. Easy way to get them smaller and be legitimate chess (This seems to be missing half the rules) would be let white move, then resign. You might have to allow white to resign / offer a draw as a move as well.
- bane 12y agoI keep saying it, but the demoscene is probably the 3rd great software movement (after commercial software and open source/free). It's a weird kind of 3rd way, it's not open source, it's free as in beer, there's tons of help/guides/talks available, but source is rarely made available due to the competitive nature of the scene. Demogroups (or members of groups) frequently end up in the commercial world and it's been C64->Amiga->DOS->Windows for the most part, almost completely skipping Linux, OS X and other x-nix derived platforms (though there are plenty of exceptions). It's unusually prolific, there are literally tens of thousand of pieces of software and at least a half million pieces of music produced by the scene...and it's almost entirely purposeless with scant few connections to the commercial world. The result is frequently stunning technology and art (and sometimes technology that's so elegant it's basically art on its own), splinter scenes and a constant showcase of real-time techniques that continue to push what even grizzled computing veterans think is possible. And oh yeah, it's mostly populated by people young enough to have not even graduated college.
- tempodox 12y agoWTF??? What is that page?