New 'Micro' Chess Engine - Iota 0.1

Discussion of chess software programming and technical issues.

Moderator: Ras

Daniel White
Posts: 33
Joined: Wed Mar 07, 2012 4:15 pm
Location: England

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Daniel White »

Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
Thank you very much Jim, your continued efforts are very much appreciated.
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Jim Ablett »

Edmund wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
I thought Tiny C was just notable for the small size of the compiler, not the size of its compiles. Couldn't you get better results with intel compiler optimizing for size?

Smallest size I can get with GCC (inc compression) is 26.5kb
Smallest size I can get with Intel (inc compression) is 30.0kb

Ok my challenge is for someone to produce a windows exe smaller than 3.50 kb

Jim.
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Jim Ablett »

Daniel White wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
Thank you very much Jim, your continued efforts are very much appreciated.
You're Welcome.

I knocked up a little logo. Of course no engine is complete without that :)

Image

Jim.
Mincho Georgiev
Posts: 454
Joined: Sat Apr 04, 2009 6:44 pm
Location: Bulgaria

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Mincho Georgiev »

Jim Ablett wrote:
Edmund wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
I thought Tiny C was just notable for the small size of the compiler, not the size of its compiles. Couldn't you get better results with intel compiler optimizing for size?

Smallest size I can get with GCC (inc compression) is 26.5kb
Smallest size I can get with Intel (inc compression) is 30.0kb

Ok my challenge is for someone to produce a windows exe smaller than 3.50 kb

Jim.
Try this, Jim:

http://bellard.org/tcc/
or
http://www.smorgasbordet.com/pellesc/
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Jim Ablett »

Mincho Georgiev wrote:
Jim Ablett wrote:
Edmund wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
I thought Tiny C was just notable for the small size of the compiler, not the size of its compiles. Couldn't you get better results with intel compiler optimizing for size?

Smallest size I can get with GCC (inc compression) is 26.5kb
Smallest size I can get with Intel (inc compression) is 30.0kb

Ok my challenge is for someone to produce a windows exe smaller than 3.50 kb

Jim.
Try this, Jim:

http://bellard.org/tcc/
or
http://www.smorgasbordet.com/pellesc/
Hi Mincho,

Tcc is what I used.

Pelles C throws up a few errors and won't compile.

Code: Select all

C:\temp\iota.c(57): warning #2099: Missing type specifier; assuming 'int'.
C:\temp\iota.c(60): warning #2027: Missing prototype for 'strtok'.
C:\temp\iota.c(60): warning #2241: The function 'gets' is marked as deprecated.
C:\temp\iota.c(61): warning #2027: Missing prototype for 'strncmp'.
C:\temp\iota.c(62): warning #2027: Missing prototype for 'strncmp'.
C:\temp\iota.c(63): warning #2027: Missing prototype for 'strncmp'.
C:\temp\iota.c(64): warning #2027: Missing prototype for 'strncmp'.
C:\temp\iota.c(71): error #2168: Operands of '=' have incompatible types 'char *' and 'int'.
C:\temp\iota.c(71): warning #2030: '=' used in a conditional expression.
C:\temp\iota.c(72): warning #2027: Missing prototype for 'strncmp'.
C:\temp\iota.c(73): error #2168: Operands of '=' have incompatible types 'char *' and 'int'.
C:\temp\iota.c(73): warning #2030: '=' used in a conditional expression.
C:\temp\iota.c(74): warning #2027: Missing prototype for 'strcmp'.
C:\temp\iota.c(74): error #2140: Type error in argument 1 to '__stoul'; expected 'const char *' but found 'int'.
Jim.
User avatar
Ajedrecista
Posts: 2201
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: New 'Micro' Chess Engine - Iota 0.1

Post by Ajedrecista »

Hello:
Mincho Georgiev wrote:
Jim Ablett wrote:
Edmund wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
I thought Tiny C was just notable for the small size of the compiler, not the size of its compiles. Couldn't you get better results with intel compiler optimizing for size?

Smallest size I can get with GCC (inc compression) is 26.5kb
Smallest size I can get with Intel (inc compression) is 30.0kb

Ok my challenge is for someone to produce a windows exe smaller than 3.50 kb

Jim.
Try this, Jim:

http://bellard.org/tcc/
or
http://www.smorgasbordet.com/pellesc/
@Mincho: Jim has already used TCC (your first link) in conjunction with UPX, as he has just written. I knew about the existance of UPX although never tried it: it is a good tool! TCC was unknown for me, but also good. I can confirm that the minimum size I got was 3584 bytes = 3.5 KB. For curious people, what I did is the following: compile iota.c source file with TCC 0.9.25:

Code: Select all

tcc -Os iota.c
It is written by memory, so may contain errors. The executable size was 6 KB; then, I used UPX 3.08 with the following arguments (after read the help shown with --help argument):

Code: Select all

upx --best --ultra-brute -o Iota_01 iota.exe
It is written again by memory, so may contain errors. The final size of Iota_01.exe was 3584 bytes, as I said before.

I wish you good luck with the development of Pawny!

@Jim: I thought that the version was 0.1 and not 1.0 of your executable... ;) Just kidding. Thank you very much for your superb compiles!

I am surprised that I can beat (in compression size) a truly entity in compilation as you are. I tried a version of GCC (download here) with the following arguments (written again from memory, so may contain typos):

Code: Select all

gcc -o Iota_01 -O2 -s iota.c
The size was 13 KB (or 13.5 KB) IIRC. Compiling with -O1 and -O2 flags, the executable size was 13 KB or 13.5 KB, while compiling with -O3 flag, the executable size was 14.5 KB; -s flag aims for a reduced size of the executable, as you know very well. So, nothing of 26.5 KB as minimum size. I do not know where I got lucky (or where you got unlucky).

@Daniel: Congratulations! It seems impossible to me that such a low amount of code is able of play legal chess... I am amazed with micro engines, the same as the normal engines. Both are an impossible task for me! Please keep up the good work.

Regards from Spain.

Ajedrecista.
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Iota 0.1

Post by Jim Ablett »

Ajedrecista wrote:Hello:
Mincho Georgiev wrote:
Jim Ablett wrote:
Edmund wrote:
Jim Ablett wrote:Hi Daniel,

Very well done. It's quite remarkable you can get working engine in such a small amount of code.

I compiled a very small windows executable using Tiny C + Upx compression and got the binary size down to an incredible 3.50 kb.

I named it 'Iota' to avoid confusion with other engine.

https://dl.dropbox.com/u/5047625/iota-10-32-tcc-ja.zip

Jim.
I thought Tiny C was just notable for the small size of the compiler, not the size of its compiles. Couldn't you get better results with intel compiler optimizing for size?

Smallest size I can get with GCC (inc compression) is 26.5kb
Smallest size I can get with Intel (inc compression) is 30.0kb

Ok my challenge is for someone to produce a windows exe smaller than 3.50 kb

Jim.
Try this, Jim:

http://bellard.org/tcc/
or
http://www.smorgasbordet.com/pellesc/
@Mincho: Jim has already used TCC (your first link) in conjunction with UPX, as he has just written. I knew about the existance of UPX although never tried it: it is a good tool! TCC was unknown for me, but also good. I can confirm that the minimum size I got was 3584 bytes = 3.5 KB. For curious people, what I did is the following: compile iota.c source file with TCC 0.9.25:

Code: Select all

tcc -Os iota.c
It is written by memory, so may contain errors. The executable size was 6 KB; then, I used UPX 3.08 with the following arguments (after read the help shown with --help argument):

Code: Select all

upx --best --ultra-brute -o Iota_01 iota.exe
It is written again by memory, so may contain errors. The final size of Iota_01.exe was 3584 bytes, as I said before.

I wish you good luck with the development of Pawny!

@Jim: I thought that the version was 0.1 and not 1.0 of your executable... ;) Just kidding. Thank you very much for your superb compiles!

I am surprised that I can beat (in compression size) a truly entity in compilation as you are. I tried a version of GCC (download here) with the following arguments (written again from memory, so may contain typos):

Code: Select all

gcc -o Iota_01 -O2 -s iota.c
The size was 13 KB (or 13.5 KB) IIRC. Compiling with -O1 and -O2 flags, the executable size was 13 KB or 13.5 KB, while compiling with -O3 flag, the executable size was 14.5 KB; -s flag aims for a reduced size of the executable, as you know very well. So, nothing of 26.5 KB as minimum size.

@Daniel: Congratulations! It seems impossible to me that such a low amount of code is able of play legal chess... I am amazed with micro engines, the same as the normal engines. Both are an impossible task for me!

Regards from Spain.

Ajedrecista.

Hi Jesus,

Ah I made fatal mistake. I compiled for speed not size. I used

Code: Select all

tcc -O3 iota.c
instead of

Code: Select all

tcc -Os iota.c
You got it down even smaller - well done.

Jim.
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Jim Ablett »

I got size reduced again using 'Mew' packer & TCC to 2.54kb

Problem is that packing with Mew will trigger false alerts with some antivirus software >

https://www.virustotal.com/file/074f694 ... 341683884/

Jim.
User avatar
Jim Ablett
Posts: 2418
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Jim Ablett »

Here is a link to the 'Mew' compressed executable >

https://dl.dropbox.com/u/5047625/iota-10-32-mew-ja.zip

I would guess this is now the smallest fully functional chess engine executable in the world.

Jim.
Mincho Georgiev
Posts: 454
Joined: Sat Apr 04, 2009 6:44 pm
Location: Bulgaria

Re: New 'Micro' Chess Engine - Yoda 0.1

Post by Mincho Georgiev »

Sorry, I didn't saw that you already use tcc. Otherwise I would be surprised by the 30k size /obiously the size optimization fixed this/. tcc and pelle's where the compilers that I was able to produce smallest win executables with. The only compilers for smaller windows executable that I have been used are masm and nasm, irrelevant in this case though.