BootChess (minimal chess engine)

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Xann
Posts: 127
Joined: Sat Jan 22, 2011 7:14 pm
Location: Lille, France

BootChess (minimal chess engine)

Post by Xann »

Hi all,

A friend just let me know about a 487-byte chess "engine". Don't expect FIDE compliance or search for this size! It will move into check for example; consider it a variant.

Release announcement: http://www.pouet.net/prod.php?which=64962
Direct link: http://olivier.poudade.free.fr/arc/BootChess.zip

Fabien.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: BootChess (minimal chess engine)

Post by mar »

some nice tricks to keep it small, including self-modifying code, relative addressing to save some bytes etc. :)
including instructions no optimizer will ever emit, I also like the idea of using segment register as a temporary and the use of BCD-adjustment instructions.
very nice.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: BootChess (minimal chess engine)

Post by hgm »

Very impressive.
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: BootChess (minimal chess engine)

Post by cdani »

Incredible!
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: BootChess (minimal chess engine)

Post by Dann Corbit »

Xann wrote:Hi all,

A friend just let me know about a 487-byte chess "engine". Don't expect FIDE compliance or search for this size! It will move into check for example; consider it a variant.

Release announcement: http://www.pouet.net/prod.php?which=64962
Direct link: http://olivier.poudade.free.fr/arc/BootChess.zip

Fabien.
Truly astounding.

Your description of your program raises the question,
"How small can a chess engine be made which can correctly process every fide rule, including draw detection, underpromotion, e.p. capture, etc.?"
I guess that it cannot be done in under 1024 bytes.
Xann
Posts: 127
Joined: Sat Jan 22, 2011 7:14 pm
Location: Lille, France

Re: BootChess (minimal chess engine)

Post by Xann »

Dann Corbit wrote:Your description of your program raises the question, ...
Just to be clear, it's not my program.

Fabien.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: BootChess (minimal chess engine)

Post by bob »

Dann Corbit wrote:
Xann wrote:Hi all,

A friend just let me know about a 487-byte chess "engine". Don't expect FIDE compliance or search for this size! It will move into check for example; consider it a variant.

Release announcement: http://www.pouet.net/prod.php?which=64962
Direct link: http://olivier.poudade.free.fr/arc/BootChess.zip

Fabien.
Truly astounding.

Your description of your program raises the question,
"How small can a chess engine be made which can correctly process every fide rule, including draw detection, underpromotion, e.p. capture, etc.?"
I guess that it cannot be done in under 1024 bytes.
Here is the smallest program that plays legal chess according to FIDE rules:

int main() {
printf("I offer a draw, accept? ");
scanf("%s", answer);
if (!strcmp(answer, "yes"))
exit 0;
printf("I resign\n");
}

:)
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: BootChess (minimal chess engine)

Post by mar »

Actually the program could always resign, making it even smaller (17 bytes):

Code: Select all

org 100h
mov ah, 9
mov dx, msg
int 21h
retn

msg db 'I resign$'
But yours is clearly stronger.
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: BootChess (minimal chess engine)

Post by cdani »

mar wrote:Actually the program could always resign, making it even smaller (17 bytes):

Code: Select all

org 100h
mov ah, 9
mov dx, msg
int 21h
retn

msg db 'I resign$'
But yours is clearly stronger.
:D :D :D
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: BootChess (minimal chess engine)

Post by nanochess »

I didn't liked the fact it puts its own king in check and only considers half-ply (per author comments), so I made from scratch my own program.

And here it is Toledo Atomchess :) in only 481 bytes of x86 machine code, it searchs 3-ply depth and doesn't make illegal moves http://nanochess.org/chess6.html

Alas, it also makes only basic chess moves.
All good things are difficult to achieve.
Toledo Nanochess book http://www.amazon.com/Toledo-Nanochess- ... 1304864375