Page 1 of 4

BootChess (minimal chess engine)

Posted: Wed Jan 28, 2015 8:08 am
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.

Re: BootChess (minimal chess engine)

Posted: Wed Jan 28, 2015 10:40 am
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.

Re: BootChess (minimal chess engine)

Posted: Wed Jan 28, 2015 11:29 am
by hgm
Very impressive.

Re: BootChess (minimal chess engine)

Posted: Wed Jan 28, 2015 2:04 pm
by cdani
Incredible!

Re: BootChess (minimal chess engine)

Posted: Thu Jan 29, 2015 8:32 am
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.

Re: BootChess (minimal chess engine)

Posted: Thu Jan 29, 2015 1:53 pm
by Xann
Dann Corbit wrote:Your description of your program raises the question, ...
Just to be clear, it's not my program.

Fabien.

Re: BootChess (minimal chess engine)

Posted: Fri Jan 30, 2015 1:12 am
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");
}

:)

Re: BootChess (minimal chess engine)

Posted: Fri Jan 30, 2015 1:29 am
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.

Re: BootChess (minimal chess engine)

Posted: Fri Jan 30, 2015 4:58 am
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

Re: BootChess (minimal chess engine)

Posted: Sat Jan 31, 2015 5:06 am
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.