BootChess (minimal chess engine)

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Xann
Posts: 125
Joined: Sat Jan 22, 2011 6:14 pm
Location: Lille, France

BootChess (minimal chess engine)

Post by Xann » Wed Jan 28, 2015 7:08 am

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: 1986
Joined: Fri Nov 26, 2010 1:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: BootChess (minimal chess engine)

Post by mar » Wed Jan 28, 2015 9:40 am

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: 23480
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: BootChess (minimal chess engine)

Post by hgm » Wed Jan 28, 2015 10:29 am

Very impressive.

User avatar
cdani
Posts: 2104
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: BootChess (minimal chess engine)

Post by cdani » Wed Jan 28, 2015 1:04 pm

Incredible!

Dann Corbit
Posts: 9895
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: BootChess (minimal chess engine)

Post by Dann Corbit » Thu Jan 29, 2015 7:32 am

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: 125
Joined: Sat Jan 22, 2011 6:14 pm
Location: Lille, France

Re: BootChess (minimal chess engine)

Post by Xann » Thu Jan 29, 2015 12:53 pm

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

Fabien.

bob
Posts: 20406
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: BootChess (minimal chess engine)

Post by bob » Fri Jan 30, 2015 12:12 am

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: 1986
Joined: Fri Nov 26, 2010 1:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: BootChess (minimal chess engine)

Post by mar » Fri Jan 30, 2015 12:29 am

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: 2104
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: BootChess (minimal chess engine)

Post by cdani » Fri Jan 30, 2015 3:58 am

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 4:34 pm
Location: Mexico, Mexico
Contact:

Re: BootChess (minimal chess engine)

Post by nanochess » Sat Jan 31, 2015 4:06 am

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

Post Reply