BootChess (minimal chess engine)

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

Moderators: hgm, Rebel, chrisw

User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

hgm wrote: Wed Dec 11, 2019 8:40 am My first chess program (for the 6800 micro-processor) also accepted illegal moves. The advantage of that was that it would allow you to castle and perform e.p. capture although it did not know those concepts, by entering those as multiple moves: Kef1-Kg1-Rf1 for O-O, or e5xd5-e5-d6 for e5xd6. It would only move itself when you typed 'enter' (stateless protocol! :wink: ).
Interesting idea, although I suppose it still didn't work for promotions.

Do you happen to know the size of the compiled code?
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: BootChess (minimal chess engine)

Post by hgm »

You mean of that 6800 Chess program? It was not compiled, but hand-assembled (poking the machine code as hex numbers into the 2KB RAM of the machine). The code ran from hex address 100 to 5c4, and there were initialized tables from 600 to 707. So that makes it about 1.5KB.
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

hgm wrote: Wed Dec 11, 2019 9:17 am You mean of that 6800 Chess program? It was not compiled, but hand-assembled (poking the machine code as hex numbers into the 2KB RAM of the machine).
Now that's what I call old-school! :D

However, you got me thinking. If I apply the same trick to my program, it would make it full chess while only adding a few bytes...
hgm wrote: So that makes it about 1.5KB.
So LeanChess would still be considerable smaller (while still playing awfully, obviously).

Now, I'm assuming the 6800 program you're referring to is Usurpator. I'm considering naming mine LeanChess Usurper Edition so that everybody (in the know) understands where the inspiration comes from.
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: BootChess (minimal chess engine)

Post by hgm »

Yes, this was Usurpator I, and I wrote it on the computer of a friend which was staying at my place for repairs. Later (when I owned a computer myself) I wrote a somewhat larger program Usurpator II for 6502.
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

That's truly impressive.

In the meantime, I implemented your idea, and it works like a charm (although I'm still playing against myself):

Image
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

Well, it looks like I finally nailed it. 334 bytes, and it should pass H.G.Muller's test, thanks to H.G.Muller!

Regular move: Algebraic
Queenside castling: e1c1a1d1
Kingside castling: e1g1h1f1
En passant capture (example): d5e5e5e6
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

Optimised and added null-move support.

At 333 bytes, it's a beast in half the size :P

Image
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

Added double push.

The final size is 350, 2 bytes fewer than ChesSkelet.
User avatar
leanchess
Posts: 176
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: BootChess (minimal chess engine)

Post by leanchess »

It seems I don't have the permission to edit my own posts, so I'm forced to add this as a reply.

Found a bug in the king's move generation; attaching a fixed version.