Nanochess
nanochess.org · Personal blog · on HN since 2014
Óscar Toledo writes about tiny chess programs, retro game ports, and old-computer programming, including his IOCCC-winning Toledo Nanochess.
What HN saysCommenters like the annotated source code of his tiny chess engine and compare it to Microchess; one notes the sad news of his wife's death.
46HN people shared it
34linked it in comments
28stories submitted
1.4Kstory points
3 months agolast shared
2014people per year2026
Most-shared posts
- 1JavaScript Chess Game in 2.1kb8 people · 7 points · first shared 2018 · 1 comments on HN
- 2Nanochess6 people · 2 points · first shared 2020 · discussion on HN
- 3A chess program in 481 bytes of x86 machine code6 people · 1 points · first shared 2015 · 1 comments on HN
- 4Chess35 people · first shared 2015
- 5Chess5 people · first shared 2014
- 6IntyBASIC: A Basic Compiler for Intellivision3 people · 36 points · first shared 2023 · 4 comments on HN
- 7Akalabeth: Porting from AppleSoft Basic to Gwbasic3 people · 4 points · first shared 2019 · 1 comments on HN
- 8My teen years: The transputer operating system2 people · 257 points · first shared 2025 · 67 comments on HN
- 9I coded a Pascal compiler for transputer as a teen in 19932 people · 180 points · first shared 2025 · 63 comments on HN
- 10My first Z80 assembly language program2 people · 173 points · first shared 2021 · 31 comments on HN
- 11Atari 2600 Video Chess disassembled and commented2 people · 35 points · first shared 2023 · discussion on HN
- 12Developing a windowed OS for a homebrew Am29000 computer2 people · 5 points · first shared 2026 · discussion on HN
- 13Klondike Solitaire game for curses in 5k of C2 people · 1 points · first shared 2026 · discussion on HN
- 14Tiny chess 12 people · first shared 2020
- 15Author2 people · first shared 2024
What HN people wrote when they linked it
nextaccountic · 2026-03-31
And I guess my point is. For the firstt some decades, while they weren't exactly bound by secrecy, I think they had some obscurity, and were just doing their things in private (which involved things like bare metal assembly, building an operating system, doing embedded work, retrocomputing, etc). Not exactly sure, but from what I gather the appearances they had with media, awards etc. were relatively recent
But when a younger member of the family published nanochess [0] and other entries to IOCCC [1] they gained international notoriety
In any case, see also the history page [2] in the family website for context
[0] http://nanochess.org but see repositories in https://github.com/nanochess for other projects
[1] https://www.ioccc.org/
[2] http://www.biyubi.com/eng_historia.html
anthk · 2025-12-19
On par of Microchess https://www.benlo.com/microchess/index.html and Nanochess https://nanochess.org from Óscar Toledo.
Microchess has a C-port with an emulated MOS 6502 inside. That's it, you are actually simulating a barebones Kim-1 with Microchess as the bundled "ROM" already in RAM.
I might port the C port to its transputer with Micro-C if I'm bored.
thom · 2021-06-13
Always like seeing Oscar's site pop up here, so that I can tell people to check out the lovely annotated source code for Toledo Nanochess, his IOCCC-winning tiny chess engine:
https://nanochess.org/chess3.html#book
burkaman · 2021-03-07
huskyr · 2020-12-25
This game was written by Oscar Toledo, whose wife apparently died just three weeks ago (see https://nanochess.org/). So sad :(
feiss · 2019-06-07
The author is an amazing code optimizer and obfuscator, and was winner of IOCCC many times. Look what he did in js1k 2010: A js chess in 1023 Bytes: https://js1k.com/2010-first/demo/750
His website has much more cool stuff: http://nanochess.org/index.html
rwmj · 2021-08-29
This guy I think: https://nanochess.org/
omoikane · 2026-08-08
Related, Oscar Toledo also made a tiny Klondike Solitaire program for IOCCC, I wonder if it was inspired by this one:
https://nanochess.org/klondike_in_c.html
https://news.ycombinator.com/item?id=48450024 - Klondike Solitaire game for curses in 5k of C (2026-06-08, 17 comments)
dmurray · 2026-02-14
ToledoChess [0] has a few implementations of this in different languages. Some highlights:
2KB of JavaScript with castling, en passant, promotion, search and even a GUI
326 bytes of assembly, without the special rules
I don't think the author has a UCI-compliant one, but it should be easier than the GUI. There are forks of the JS one that might do it.
[0] https://nanochess.org/chess6.html
WillAdams · 2026-01-27
No, you don't need to learn BASIC before assembly, but many books of the time went that route, e.g.,
https://www.goodreads.com/en/book/show/5011686-apple-machine-language
Here is an interesting article on porting a BASIC game for the Apple II to GW BASIC:
https://nanochess.org/akalabeth.html
and it includes a link to the documented source code for Akalabeth (also known as Ultima 0)
Somewhere, there's an article discussing the assembly-language like bit-blitting used to draw the high-res graphics in a timely fashion and the variable/memory management techniques needed to drive that which I'm sure a bit of searching will turn up (or one can derive it from the source).
namuol · 2025-02-13
I often wonder what sort of tools like this must have existed in-house at the many small game development studios of the era.
This one reminds me of another modern compiler for the Intellivision console called INTYBasic, which has an extremely impressive suite of games and NES remakes implemented in it:
https://nanochess.org/intybasic.html
https://youtu.be/h7ttNz2UVw8
For something even higher level check out GBStudio:
https://www.gbstudio.dev/
tromp · 2024-03-24
A nice showcase of Postscript's abilities, which I first became aware of around 1990, when I sent a tiny program to a Postscript printer to generate a 1024x1024 maze, taking half a day to finish. The graphics are simple but good looking. The engine is weak as expected for a tiny engine. The game I played with my first 4 moves of e2e4, d2d4, e4e5, and d4d5 resulted in checkmate on move 18. I wasn't sure if it would accept en-passant capture but it did. Other tiny engines like Micro-Max [1] and nanochess [2] are much stronger. An interesting long running (2009-2021) discussion between their authors may be found on the chess programming forum [3].
[1] https://home.hccnet.nl/h.g.muller/max-src2.html
[2] https://nanochess.org/chess3.html
[3] http://talkchess.com/forum3/viewtopic.php?f=7&t=26622
philomath_mn · 2024-03-20
Good catch -- those same books show up on the nanochess site:
https://nanochess.org/author.html
Odd that he doesn't mention the "scientist" people may be looking for is his father, but everything else lines up.
dloss · 2024-03-19
Made by Oscar Toledo G., who learned assembly language by age 9 and won the International Obfuscated C Contest five times.
https://nanochess.org/author.html
Trixter · 2023-11-22
A more complete chess that fits in a boot sector is Toledo Atomchess: https://nanochess.org/chess6.html
acqq · 2023-06-08
also:
C:
Nanochess online:
https://nanochess.org/chess3.html
Micro-Max:
https://home.hccnet.nl/h.g.muller/max-src2.html
assembly:
Atomchess Game
The world's smallest chess program in x86 machine code, only 326 bytes!
https://nanochess.org/chess6.html
tyingq · 2021-06-13
If you download his MSX rom, from https://nanochess.org/archive/karate2.zip and then unzip, and extract the karate2_msx.rom file, you can play it online.
https://webmsx.org/ is an online MSX emulator. Just click the "load files" link and give it the ROM file. Space bar and arrow keys for controls.
cortesoft · 2021-03-08
You can see the Math.random call in the source code: https://nanochess.org/chess4.html#sour
bjconlan · 2021-03-08
Damn, I just got hooked on this and was hoping someone on here would have already done a line by line translation of how this is possible. Time to brush up on common ai techniques (or perhaps the old dark arts) either way this is both very humbling and inspiring.
(Scanned the Oscar Toledo github/site and found this for anyone else interested https://nanochess.org/chess4.html)
mattround · 2021-03-07
Original engine's here (only looks ahead 3 steps instead of 4) https://nanochess.org/archive/tiny_chess_2.html
SatvikBeri · 2021-03-07
The javascript engine: https://nanochess.org/chess4.html#sour
The slightly older C version: https://nanochess.org/chess1.html
The author wrote a book commenting and explaining the C version, it's 170 pages long! https://nanochess.org/chess3.html#book
Edit: MicroMax is a close competitor that also has very good explanations on their website https://home.hccnet.nl/h.g.muller/max-src2.html .
Someone · 2021-03-07
I think https://nanochess.org/archive/tiny_chess_1.html is that, possibly for an older/newer version of the engine (found via https://nanochess.org/chess4.html#sour, which SatvikBeri mentioned in a different message)
Still looks a bit weird on my iPad (huge black pawns), but easier to beat because it’s easier to see the board.
7373737373 · 2020-12-28
Here's chess in 1kb of Javascript: https://nanochess.org/archive/tiny_chess_1.html (from here: https://nanochess.org/chess.html)
In fact, I just started a resource limited chess program competition: https://rlc-chess.com
alecco · 2020-05-31
nanochess guy has some ebooks: https://nanochess.org/store.html
jdkee · 2020-01-18
Checkout Oscar Toledo’s nanochess for tiny chess implementations.
https://nanochess.org/chess.html
tcbawo · 2019-03-30
This is very cool. I've been playing Nanochess since it popped up on HN (http://www.nanochess.org/chess.html). He has a similarly sized and restricted version, but remarkably includes the full rule set and competitive AI in a 1k Javacript package.
sehugg · 2018-09-15
You could even make a chess program in 392 bytes: http://nanochess.org/chess6.html
schoen · 2018-09-04
See also http://nanochess.org/chess4.html (discussions and links to 2K and 1K Javascript implementations).
"Take note that the 1018 octets of my Javascript code include an artificial intelligence and also the user's interface and chessboard visualization"
david-given · 2017-03-31
It didn't understand castling, en passant and promotions. It would also only play white.
I did once try to pit it against a modern engine. It seemed to do reasonably well until the modern engine sneakily castled, and I was unable to tell 1k Chess about this, thus forcing it to forfeit the game.
Of course, since posting that, I since found this:
http://nanochess.org/chess6.html
Chess for the PC; 392 bytes. You put it in your boot sector. Still no castling, en passant and promotions, though, although there's an 831 byte version which has those.
ctdonath · 2015-01-27
For interesting contrast: Toledo Nanochess http://www.nanochess.org/chess3.html is the smallest C implementation of a full & decent chess program.