Simple open source program wanted

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Simple open source program wanted

Post by Dann Corbit »

bhlangonijr wrote:In my opinion the best one is Sungorous, written by Pablo Vasques:
http://sites.google.com/site/sungorus/

It is written with a very clean and straightforward C code. The entire search code has only 154 lines of code. Although the code base of Sungorus is relatively small, it has a lot of important features such as a good move ordering function, hash tables, null move pruning (the version 1.2 had also LMR, but it seems the author removed it for some reason), fast move generation, etc

Currently the engine is #142 on CCRL with 2350 ELO.
I made a C++ version of Sungorus that has no global variables.
Since the license is not clear, I won't post it on my site, but I did send a copy to the author.

Now main.cpp looks like this:

Code: Select all

#include "sungorus.h"

int main()
{
    sungorus s;
    s.UciLoop();
    return 0;
}
The nice thing about a C++ conversion is that all data objects are now class members so it should be much easier to make an SMP version.
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Simple open source program wanted

Post by Pablo Vazquez »

Dann Corbit wrote:
bhlangonijr wrote:In my opinion the best one is Sungorous, written by Pablo Vasques:
http://sites.google.com/site/sungorus/

It is written with a very clean and straightforward C code. The entire search code has only 154 lines of code. Although the code base of Sungorus is relatively small, it has a lot of important features such as a good move ordering function, hash tables, null move pruning (the version 1.2 had also LMR, but it seems the author removed it for some reason), fast move generation, etc

Currently the engine is #142 on CCRL with 2350 ELO.
I made a C++ version of Sungorus that has no global variables.
Since the license is not clear, I won't post it on my site, but I did send a copy to the author.

Now main.cpp looks like this:

Code: Select all

#include "sungorus.h"

int main()
{
    sungorus s;
    s.UciLoop();
    return 0;
}
The nice thing about a C++ conversion is that all data objects are now class members so it should be much easier to make an SMP version.
Thanks Carlos and Dann. I didn't think anyone would actually look at the source :). Dann, thanks a lot for your C++ version, I liked it very much. You are free, of course, to post it on your site.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Simple open source program wanted

Post by Dann Corbit »

Pablo Vazquez wrote:
Dann Corbit wrote:
bhlangonijr wrote:In my opinion the best one is Sungorous, written by Pablo Vasques:
http://sites.google.com/site/sungorus/

It is written with a very clean and straightforward C code. The entire search code has only 154 lines of code. Although the code base of Sungorus is relatively small, it has a lot of important features such as a good move ordering function, hash tables, null move pruning (the version 1.2 had also LMR, but it seems the author removed it for some reason), fast move generation, etc

Currently the engine is #142 on CCRL with 2350 ELO.
I made a C++ version of Sungorus that has no global variables.
Since the license is not clear, I won't post it on my site, but I did send a copy to the author.

Now main.cpp looks like this:

Code: Select all

#include "sungorus.h"

int main()
{
    sungorus s;
    s.UciLoop();
    return 0;
}
The nice thing about a C++ conversion is that all data objects are now class members so it should be much easier to make an SMP version.
Thanks Carlos and Dann. I didn't think anyone would actually look at the source :). Dann, thanks a lot for your C++ version, I liked it very much. You are free, of course, to post it on your site.
Here is the C++ version:
http://cap.connx.com/chess-engines/new- ... s-13-pp.7z
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Simple open source program wanted

Post by Dann Corbit »

WinPooh wrote:You can take a look at GreKo. Some people say it is relatively readable.
This is also very nice code. Since it uses STL stuff, I think it might be a little tricky to port to wimpy languages.
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Simple open source program wanted

Post by PK »

ok, had a spare couple of minutes for programming (and couldn't touch Glass because of heavy testing it is undergoing right now), so here comes a little addition to Dann's C++ code. now the little thing uses principal variation search.

www.koziol.home.pl/sungrous_mod.zip

and yes, it's a pleasure to modify this code, I wish I could write in such a simple manner.
bhlangonijr
Posts: 482
Joined: Thu Oct 16, 2008 4:23 am
Location: Milky Way

Re: Simple open source program wanted

Post by bhlangonijr »

Dann Corbit wrote:
I made a C++ version of Sungorus that has no global variables.
Since the license is not clear, I won't post it on my site, but I did send a copy to the author.

Now main.cpp looks like this:

Code: Select all

#include "sungorus.h"

int main()
{
    sungorus s;
    s.UciLoop();
    return 0;
}
The nice thing about a C++ conversion is that all data objects are now class members so it should be much easier to make an SMP version.
Good stuff Dann! I just downloaded it for using in my personal tests. The thing I most like in it is having a very good playing strength without sacrifice the readability and simplicity of the code.
When I was first trying to learn chess programming, I took a look at Arasan's source code and thought: "My god, is it how a chess program must looks like?". Of course it is a good chess program, but the code is too complex for my taste. But then I found good stuffs like Sungorus, Scorpio, Glaurung, among others. :)
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Simple open source program wanted

Post by Dann Corbit »

PK wrote:ok, had a spare couple of minutes for programming (and couldn't touch Glass because of heavy testing it is undergoing right now), so here comes a little addition to Dann's C++ code. now the little thing uses principal variation search.

www.koziol.home.pl/sungrous_mod.zip

and yes, it's a pleasure to modify this code, I wish I could write in such a simple manner.
Looks like I did something to goof up the NPS display that affects both my version and your version. It works correctly in the original.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Simple open source program wanted

Post by Dann Corbit »

PK wrote:ok, had a spare couple of minutes for programming (and couldn't touch Glass because of heavy testing it is undergoing right now), so here comes a little addition to Dann's C++ code. now the little thing uses principal variation search.

www.koziol.home.pl/sungrous_mod.zip

and yes, it's a pleasure to modify this code, I wish I could write in such a simple manner.
At first blush, the PVS modification seems to be worth about 100 points.

We'll see how it stands in the morning

Code: Select all

   Program               Elo    +   -   Games   Score   Av.Op.  Draws
 1 Sungorus 64 bit pvs : 2574  193 182    13    65.4 %   2464   23.1 %
 2 Sungorus ja ANSI C  : 2467  164 168    14    42.9 %   2517   28.6 %
 3 Sungorus cpp 64     : 2462  179 185    13    42.3 %   2515   23.1 %
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Simple open source program wanted

Post by Pablo Vazquez »

PK wrote:ok, had a spare couple of minutes for programming (and couldn't touch Glass because of heavy testing it is undergoing right now), so here comes a little addition to Dann's C++ code. now the little thing uses principal variation search.

www.koziol.home.pl/sungrous_mod.zip

and yes, it's a pleasure to modify this code, I wish I could write in such a simple manner.
Thanks Pawel. I've been using PVS for some time in the development version with some positive effect, although I implemented it a bit differently. I will try your way.
Pablo Vazquez
Posts: 154
Joined: Thu May 31, 2007 9:05 pm
Location: Madrid, Spain

Re: Simple open source program wanted

Post by Pablo Vazquez »

bhlangonijr wrote:
Dann Corbit wrote:
I made a C++ version of Sungorus that has no global variables.
Since the license is not clear, I won't post it on my site, but I did send a copy to the author.

Now main.cpp looks like this:

Code: Select all

#include "sungorus.h"

int main()
{
    sungorus s;
    s.UciLoop();
    return 0;
}
The nice thing about a C++ conversion is that all data objects are now class members so it should be much easier to make an SMP version.
Good stuff Dann! I just downloaded it for using in my personal tests. The thing I most like in it is having a very good playing strength without sacrifice the readability and simplicity of the code.
When I was first trying to learn chess programming, I took a look at Arasan's source code and thought: "My god, is it how a chess program must looks like?". Of course it is a good chess program, but the code is too complex for my taste. But then I found good stuffs like Sungorus, Scorpio, Glaurung, among others. :)
You can take a look at Olithink, it is smaller and stronger than my program, although some variable names are a bit cryptic.