Permissive C chess engine

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Look
Posts: 382
Joined: Thu Jun 05, 2014 2:14 pm
Location: Iran
Full name: Mehdi Amini

Permissive C chess engine

Post by Look »

Hi,

what is the strongest chess engine with permissive license (MIT , BSD , ...) written in C ?
Farewell.
smatovic
Posts: 3224
Joined: Wed Mar 10, 2010 10:18 pm
Location: Hamburg, Germany
Full name: Srdja Matovic

Re: Permissive C chess engine

Post by smatovic »

1. Here is a list of MIT engines on CPW (Arasan is not listed):
https://www.chessprogramming.org/Category:MIT

2. Check engines on CCRL:
https://computerchess.org.uk/ccrl/404/

According to CPW and CCRL:

Arasan is the strongest MIT/C++ engine:
https://computerchess.org.uk/ccrl/404/c ... 4-bit_8CPU

Idk about MIT and C.

--
Srdja
Dann Corbit
Posts: 12777
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Permissive C chess engine

Post by Dann Corbit »

Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12777
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Permissive C chess engine

Post by Dann Corbit »

The chess engine Ippolit was released as public domain:
http://ippolit.wikispaces.com/Features
Also C++ and not C.
I found memory bugs in it, so even though it is strong and public domain, I guess it is not the best place to start.

If you want to get a big jump on a a powerful engine, you could use a permissive source license and not share your contributions.
But I think that will give you a stink eye from the chess programming community.
But if you at least describe exactly what it is that you are doing, there would not be anything legally wrong.

I suggest an interesting alternative idea. Study the source of Olithink. It is written in C, and it is tiny and powerful.
If you wrote an SMP version it would probably be very strong.
It uses bitboards and there are no comments, but it is beautifully written and it will be a fun study.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
OliverBr
Posts: 794
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Permissive C chess engine

Post by OliverBr »

Look wrote: Wed May 10, 2023 6:37 am Hi,

what is the strongest chess engine with permissive license (MIT , BSD , ...) written in C ?
OliThink (now 5.10.5) has the most permissive licence possible and it's written in pure C.
You can use and copy at your will. I think the licence model is MIT.

PS: Would need a fast Linux compile with clang, if somebody can provide?
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink
Dann Corbit
Posts: 12777
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Permissive C chess engine

Post by Dann Corbit »

I made the hash a little larger. Otherwise, this is Olithink on a single thread:

Code: Select all

C:\Users\dannc\chess\OliThink-master\src>ot
new
post
st 999
go
move d2d4
go
move g8f6
go
move c2c4
go
 1    -9      0         6 b7b6
 2   -18      0        22 b7b6 b2b3
 3    32      0       186 d7d5 e2e3 e7e6
 4    27      0       328 d7d5 e2e3 e7e6 b2b3
 5    33      0       747 d7d5 e2e3 e7e6 h2h3 c7c6
 6    39      1      2959 b8c6 g1f3 d7d5 b2b3 e7e6
 7    -6      1      7149 b8c6 b1c3 e7e6 e2e4 d7d6 f2f3 a7a6
 8     1      1     16114 d7d5 e2e3 b8c6 c4d5 f6d5 b1c3 c8f5 g1f3
 9    -3      3     33581 d7d5 b1c3 b8c6 c4d5 f6d5 e2e4 d5c3 b2c3 e7e6
10    -3      3     52700 d7d5 b1c3 e7e6 g1f3 f8b4 e2e3 b8c6 c4c5 b4c3 b2c3 e8g8
11    -3      6    122526 d7d6 g1f3 c7c5 d4c5 d8a5 b1c3 a5c5 e2e4 b8c6 c1f4 e7e6
12   -11     17    447689 e7e6 g1f3 f6e4 b1c3 e4c3 b2c3 d7d5 c1f4 f8e7 c4c5 e8g8
13   -17     25    698176 e7e6 e2e3 d7d5 b1c3 b8c6 g1f3 f6e4 c1d2 f8e7 c4c5 e4d2 d1d2 e8g8 f1d3
14   -17     33    925663 e7e6 e2e3 d7d5 b1c3 b8c6 g1f3 f6e4 c1d2 f8e7 c4c5 e4d2 d1d2 e8g8 f1d3
15    -4     56   1683855 d7d6 g1f3 c7c5 e2e3 b8c6 b1c3 e7e5 d4e5 c6e5 f3e5 d6e5 f1d3 g7g6 f2f3 c8f5 d3f5
16   -15     91   2750437 d7d6 g1f3 c7c5 e2e3 b8c6 b1c3 e7e5 d4e5 c6e5 f3e5 d6e5 f1d3 g7g6 d1d2 c8f5 d3f5
17   -15    123   3808427 d7d6 g1f3 c7c5 e2e3 b8c6 b1c3 d8a5 f1d3 c8d7 h2h3 c6b4 e1g1 a8c8 f1e1 b4d3 d1d3
18   -15    195   5950637 c7c6 b1c3 d7d5 c4d5 c6d5 g1f3 b8c6 e2e3 c8f5 f1d3 f5d3 d1d3 e7e6 e1g1 d8b6 f1d1
19    -7    362  10961367 e7e6 g1f3 f8e7 b1c3 d7d5 c4d5 e6d5 c1f4 f6h5 f4d2 b8c6 d1b1 e8g8 e2e3 a7a6 f1d3
20    -7    433  13061365 e7e6 g1f3 f8e7 b1c3 d7d5 c4d5 e6d5 e2e3 e8g8 c1d2 b8c6 h2h3 f6e4 d1b3 e4c3 b3c3 e7b4 c3b3 b4d2 f3d2
21   -16    576  17410661 e7e6 g1f3 d7d5 e2e3 f8e7 c4d5 e6d5 b1c3 b8c6 a2a3 f6e4 f1d3 e4c3 b2c3 e8g8 e1g1 c8g4 d1c2 f7f5 c1d2
22   -18    770  23120936 e7e6 g1f3 d7d5 e2e3 f8e7 c4d5 e6d5 b1c3 c7c6 f1d3 e8g8 e1g1 b7b6 c1d2 c8a6 d3a6 b8a6 f3e5 d8c8 a2a3 a8b8
23   -19   1025  30678069 e7e6 g1f3 d7d5 e2e3 f8e7 c4d5 e6d5 b1c3 e8g8 f1d3 c8g4 a2a3 c7c6 c1d2 b8d7 h2h3 g4f3 d1f3 g8h8 e1g1 e7d6 b2b4
24   -18   1550  46738511 e7e6 g1f3 d7d5 b1c3 f8e7 c1g5 c7c6 e2e3 b8d7 c4d5 e6d5 h2h3 e7d6 f1d3 e8g8 e1g1 d7b6 e3e4 b6c4 d3c4 d5c4 e4e5 h7h6
25   -24   2400  71190499 e7e6 g1f3 d7d5 b1c3 f8e7 c1g5 c7c6 e2e3 b8d7 f1d3 d5c4 d3c4 h7h6 g5f6 d7f6 a2a3 e8g8 e1g1 c8d7 c4d3 g7g6 f3e5 d8b6
26   -22   3051  89864782 e7e6 g1f3 d7d5 b1c3 f8e7 c1g5 c7c6 e2e3 e8g8 g5f6 e7f6 c4d5 c6d5 f1d3 b8c6 e1g1 d8c7 f1e1 c8d7 d1c2 h7h6
27   -18   3358  98698120 e7e6 b1c3 d7d5 g1f3 f8e7 c1g5 c7c6 e2e3 h7h6 g5f6 e7f6 d1b3 e8g8 a1c1 f6e7 f1d3 g7g6 c1d1 f7f5 f3e5 g8h7 c4c5
28   -12   3856 113236286 e7e6 b1c3 d7d5 g1f3 f8e7 c1g5 c7c6 e2e3 h7h6 g5f6 e7f6 c4d5 e6d5 f1d3 f6e7 h2h3 b8a6 e1g1 c8d7 d3a6 b7a6 f3e5 e8g8 e5d7
29   -10   5697 165700675 e7e6 b1c3 d7d5 g1f3 f8e7 c1g5 c7c6 e2e3 b8d7 f1d3 d5c4 d3c4 e8g8 g5f6 d7f6 e1g1 f6d5 d1b3 d5c3 b3c3 c8d7 a2a3 f7f6 f1c1 f6f5
30   -13   7783 225156817 e7e6 b1c3 d7d5 g1f3 f8e7 c1g5 b8d7 e2e3 c7c6 f1d3 d5c4 d3c4 h7h6 g5f6 d7f6 c4d3 e8g8 e1g1 f6d5 h2h3 d5c3 b2c3 c8d7 f3e5
31   -19  15353 441370360 e7e6 b1c3 d7d5 e2e3 d5c4 f1c4 c7c5 g1f3 c5d4 d1d4 d8d4 e3d4 a7a6 c1d2 b7b6 a1c1 b6b5 c4d3 c8b7 e1g1 b8c6 c3b5 a6b5 d3b5 a8a2 b5c6 b7c6
32    -7  27230 781494831 e7e6 b1c3 d7d5 g1f3 c7c5 c4d5 f6d5 c3d5 d8d5 e2e3 b8c6 d4c5 d5d1 e1d1 f8c5 c1d2 c5e7 f1c4 e8g8 d1c2 c8d7 a1d1 a7a6 c2b1
33    -6  31159 895251801 e7e6 g1f3 d7d5 e2e3 d5c4 f1c4 c7c5 b1c3 c5d4 f3d4 c8d7 e1g1 d8c7 c4e2 a7a6 d4f3 f8d6 e3e4 b8c6 c1e3 e8g8
34   -10  36991 1058781797 e7e6 g1f3 f8e7 b1c3 d7d5 c4d5 e6d5 e2e3 c7c6 f1d3 e7d6 e1g1 e8g8 c1d2 b8a6 a2a3 f8e8 d1c2 c8d7 b2b4 d8e7 b4b5 a6c7 a3a4 a8b8 f3g5 c6b5 d3h7 f6h7
35   -11  85581 2424550377 e7e6 b1c3 d7d5 g1f3 b8d7 e2e3 f8e7 c4d5 e6d5 f1d3 c7c6 b2b3 e7d6 e1g1 d8e7 d1c2 e8g8 f3g5 g7g6 e3e4 d5e4 c3e4 f6e4 g5e4 d7f6 e4d6
36   -13  99901 2821596006 e7e6 e2e3 c7c5 d4c5 f8c5 g1f3 d7d6 b1c3 e8g8 f1d3 a7a5 e1g1 b7b6 a2a3 c8b7 b2b3 b8d7 c1b2 g8h8 c3b5 d8b8 b2d4 b7f3 g2f3 d7e5 d3c2 f8e8
move e7e6
go
 1     0      0         4 e2e3
 2    -9      0        24 e2e3 a7a6
 3    -6      0        65 e2e3 b7b6 b2b3
 4   -19      0       218 e2e3 b7b6 h2h3 a7a5
 5   -15      0      1145 b2b3 b7b6 f2f3 b8c6 e2e4
 6    15      0      5354 b1c3 f8b4 g1f3 b4c3 b2c3 f6e4
 7   -11      0      8508 b1c3 d7d5 e2e3 c8d7 g1f3 b8c6
 8    -4      2     12846 b1c3 d7d5 e2e3 c8d7 g1f3 b8c6 c1d2 f8b4
 9   -12      2     34859 e2e3 f6e4 b1c3 f8b4 c1d2 e4d2 d1d2 b8c6
10    -2      3     86575 b1c3 d7d5 c4d5 e6d5 c1f4 f8b4 a1c1 f6e4 e2e3
11     6      5    122777 b1c3 d7d5 e2e3 b8c6 c4d5 e6d5 f1b5 c8d7 g1f3 d7f5 e1g1
12     2      8    190522 b1c3 d7d5 e2e3 b8c6 g1f3 f8b4 c1d2 e8g8 c4c5 b4c3 d2c3 f6e4
13    12     11    296910 b1c3 d7d5 e2e3 b8c6 g1f3 f8e7 c4d5 f6d5 f1d3 e8g8 c3d5 d8d5 c1d2
14     3     20    586023 e2e3 b8c6 g1f3 f8e7 f1d3 e8g8 a2a3 d7d5 c4d5 e6d5 b1c3 c8d7 e1g1
15     4     31    890125 e2e3 b8c6 g1f3 f8e7 f1d3 e8g8 c1d2 d7d5 e1g1 c6b4 d2b4 e7b4 b1c3 c8d7 c4d5
16     5     47   1361711 e2e3 b8c6 g1f3 f8e7 f1d3 d7d5 c1d2 c6b4 d2b4 e7b4 b1c3 b4c3 b2c3 f6e4 d1b3 e8g8 e1g1 c7c6
17     8     72   2167813 e2e3 b8c6 g1f3 f8e7 f1d3 d7d5 e1g1 e8g8 b1c3 c6b4 d3e2 f6e4 f3e5 e4c3 b2c3 b4c6 e5c6
18     8    187   5721936 e2e3 d7d5 g1f3 f8e7 f1d3 c7c5 c4d5 f6d5 d4c5 d5b4 d3b5 b8c6 a2a3 d8d1 e1d1 b4d5 c1d2 e7c5
19    24    355  10940923 g1f3 d7d5 b1c3 f8e7 c1g5 c7c6 e2e3 h7h6 g5f6 e7f6 d1b3 f6e7 c4c5 g7g5 f3d2 b7b6 b3b4
20    17    434  13418512 g1f3 d7d5 b1c3 f8e7 e2e3 b8c6 f1d3 c6b4 d3e2 e8g8 e1g1 d5c4 e2c4 c8d7 f3e5 b4c6 e3e4 a7a6 c1e3 c6e5
21    19    541  16710728 g1f3 d7d5 b1c3 f8e7 e2e3 b8c6 f1d3 c6b4 d3e2 e8g8 e1g1 d5c4 e2c4 f6d7 c1d2 d7b6 c4b5 c8d7 e3e4 d7b5
22    17    692  21380547 g1f3 d7d5 b1c3 f8e7 e2e3 e8g8 c4d5 f6d5 f1d3 b8c6 a2a3 f7f5 e1g1 d5b6 b2b4 a7a6 a1b1 c8d7 h2h3 d8e8 c1d2 g8h8
23     8    878  26863747 g1f3 d7d5 b1c3 f8e7 e2e3 e8g8 c4d5 f6d5 f1d3 b8c6 a2a3 f7f5 e1g1 d5b6 b2b4 a7a6 a1b1 c8d7 h2h3 h7h6 g1h2 g8h7
24    17   1252  37715600 g1f3 d7d5 b1c3 f8e7 e2e3 e8g8 c1d2 c7c6 f1d3 d5c4 d3c4 a7a6 e1g1 b7b5 c4d3 c6c5 d3e4 a8a7 d4c5 e7c5 f3e5
25     6   2036  60451716 g1f3 d7d5 c4d5 e6d5 e2e3 c7c6 f1d3 f8e7 b1c3 e8g8 c1d2 e7d6 e1g1 b8a6 d3a6 b7a6 d1c2 d8b6 c3a4 b6b5 a4c5 a8b8 c5d3 h7h6
26    13   3378  99815588 g1f3 d7d5 b1c3 c7c5 c4d5 f6d5 e2e3 b8c6 f1e2 d8a5 c1d2 c5d4 f3d4 c6d4 e3d4 f8b4 d1c2 d5c3 b2c3 b4e7 c3c4 e7b4 d2b4
27    10   4808 142887802 g1f3 d7d5 b1c3 c7c5 c4d5 f6d5 e2e3 b8c6 f1e2 d8a5 d1b3 c5d4 e3d4 a5b4 e1g1 f8e7 e2b5 b4b3 a2b3 d5b4 c1g5 c8d7 g5d2
28    16   7300 214461477 g1f3 d7d5 b1c3 f8b4 c4d5 e6d5 d1b3 b8c6 e2e3 e8g8 f1d3 b4d6 e1g1 c6b4 d3e2 c7c6 c1d2 d8e7 g1h1 b4a6 e2a6 b7a6 b3a4 e7d7 f1c1
29     6   8533 250154210 g1f3 d7d5 e2e3 d5c4 f1c4 c7c5 b1c3 c5d4 e3d4 f8e7 e1g1 b8c6 c1f4 e8g8 c4b3 f6d5 c3d5 e6d5 b3a4 d8b6 a4c6 b6c6 f1e1 c8e6 d1b3
30    13  10941 319426963 g1f3 d7d5 e2e3 f8e7 c4d5 e6d5 b1c3 c7c6 f1d3 e8g8 c1d2 b8d7 e1g1 d7b6 d1c2 f8e8 e3e4 d5e4 c3e4 f6e4 d3e4 g7g6 d2h6 e7f6 c2d3 d8e7 f3e5
31    13  15162 439554841 g1f3 d7d5 b1c3 f8e7 c4d5 e6d5 e2e3 e8g8 f1d3 c7c6 e1g1 c8g4 c1d2 g4h5 d1c2 b8d7 f3h4 h5g6 h4g6 f7g6 c3e2 e7d6 e2f4 d6f4
32    11  29625 851084789 e2e3 f8e7 b1c3 d7d5 c4d5 e6d5 f1d3 c7c6 g1f3 b7b6 e1g1 a7a5 c3e2 c8a6 d3a6 a8a6 e2g3 e8g8 c1d2 a6a7 g3f5 f6e4 f5e7 d8e7 f3e5
33     3  42356 1214025177 e2e3 c7c5 d4c5 f8c5 a2a3 e8g8 g1f3 c5e7 b1c3 a7a5 b2b3 d7d6 f1e2 b7b6 e1g1 c8b7 c1b2 b8d7 f3d4 g8h8 e2f3 b7f3 d4f3 d8c8 f1e1 d7c5 h2h3 h7h6 d1c2 f6d7
34    14  68619 1942991344 b1c3 b8c6 c1g5 f8b4 a2a3 b4c3 b2c3 d7d5 g5f6 g7f6 e2e3 c6e7 c4c5 c7c6 g1e2 d8a5 d1b3 h7h5 e2c1 e6e5 f1e2 e5d4 e3d4 c8f5 c1d3 e8c8 e1g1 d8g8 a1b1 a5c7 f2f3 c8b8
35     9  91730 2597463850 b1c3 d7d5 g1f3 c7c6 e2e3 f8e7 c4d5 e6d5 f1d3 e8g8 e1g1 b8a6 a2a3 a6c7 c1d2 c8g4 h2h3 g4f3 d1f3 c7e6 f3d1 a8c8 f1e1 d8c7 d1c2 e7d6 c2b3 g8h8 g2g3
36    -4  99902 2828915118 b1c3 d7d5 g1f3 c7c6 e2e3 f8e7 c4d5 e6d5 f1d3 e8g8 e1g1 b8a6 a2a3 a6c7 c1d2 c8g4 h2h3 g4f3 d1f3 c7e6 f3d1 a8c8 f1e1 d8c7 d1c2 e7d6 c2b3 g8h8 g2g3
move b1c3
So it looks like 999 seconds will get to the working point on 36 plies.
With lazy SMP, and 64 threads it would be 15 seconds, if we had no SMP loss. There is also the hash filling faster. But I think 30 seconds to 36 plies would not be out of the question. There is a pretty good branching factor most of the time. Pretty amazing for an engine with code this compact.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
OliverBr
Posts: 794
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Permissive C chess engine

Post by OliverBr »

Thank you a lot as always, Dann.
Of course OliThink does a lot of pruning (compared to the long time 5.3.3). This is the main reason for reaching 36 plies. In particular positions it doesn't find the best solution, but generally it plays stronger.

You often suggested to implement SMP, I haven't done it yet. One of the reason was the simplicity and of course the mere fact, that OliThink is still running on one thread (It's only possible with the CECP (Xboard) protocol, btw).

Many engines do only have one metric in their development: ELO. I had some discussions at a tourney with other developers: I do not see ELO as the only metric, because then what can be achieved? Surpassing Stockfish?

You know a possibility to get a Linux clang executable? (I have only access to gcc at the moment, which is 10% slower than clang.
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink
User avatar
Ras
Posts: 2695
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Permissive C chess engine

Post by Ras »

OliverBr wrote: Thu Jun 15, 2023 12:52 amPS: Would need a fast Linux compile with clang, if somebody can provide?
Here: https://www.ct800.net/download/olithinkLinux64.zip
Compiled with clang14 on Linux Mint 21 (Ubuntu 22.04) using the supplied makefile. I will remove that file once you have downloaded it on your end. Btw., if you're using Windows, you can also boot a live Linux distro from USB thumbdrive, install clang in the live session if necessary, compile, and copy the executable to another drive.
Rasmus Althoff
https://www.ct800.net
OliverBr
Posts: 794
Joined: Tue Dec 18, 2007 9:38 pm
Location: Munich, Germany
Full name: Dr. Oliver Brausch

Re: Permissive C chess engine

Post by OliverBr »

Ras wrote: Thu Jun 15, 2023 1:48 pm
OliverBr wrote: Thu Jun 15, 2023 12:52 amPS: Would need a fast Linux compile with clang, if somebody can provide?
Here: https://www.ct800.net/download/olithinkLinux64.zip
Compiled with clang14 on Linux Mint 21 (Ubuntu 22.04) using the supplied makefile. I will remove that file once you have downloaded it on your end. Btw., if you're using Windows, you can also boot a live Linux distro from USB thumbdrive, install clang in the live session if necessary, compile, and copy the executable to another drive.
Thank you a lot!!!
Chess Engine OliThink: http://brausch.org/home/chess
OliThink GitHub:https://github.com/olithink