Im learning the chess engines programming, with the Capivara

Chess programming lessons for beginners and intermediate

Moderator: Andres Valverde

Im learning the chess engines programming, with the Capivara

Postby laoliveirajr » 09 Apr 2011, 19:17

I always liked chess, just as taste of computing. Making a chess engines was a way to combine two things.
I thought I would not have time to program an engine from scratch, as Tom Kerrigan suggested to me when I asked permission to make more than a derivative of TSCP (I wanted to use Stobor).
As I have little time to code, a derivative was an alternative, then I started to implement some ideas, derived from theories of mathematical school of chess (you ever tried to calculate the value of the subsequent positions, while playing live?).
The original idea was to keep the name TSCP, plus the symbol that identified the theory used in engine versions (LK, FWT ...), but one version was so bad that I thought the Tom Kerrigan would not want I damage your engine, then I baptized the derived engine with the name Capivara (in Brazil, the player who has bad game, no technique or study).
I believed that the assessment was already mature enough in the LK007s1 version, then it was time to change other parts of the engine (I had also added the engine: the representation on the board with the BITBOARDS of Michael Sherwin, and changes that Jim Ablett included in TSCP-1.81e (FEN and NullMoves of Norman Blais, and some other improvements)).
The version LK007t02, was an attempt to change the Tree Search, something that did not work, because I inserted errors that I could not even identify, resulting in weird side effects! So I abandoned the v007tXX series and I returned to the previous version (LK007s1), and found some errors that always accompanied the Capivara, since LK007s version, and emerged the Capivara LK 0.07s2 !

Lourenço

P.S.
Excuse me, for I do not write as well in the English language.
Last edited by laoliveirajr on 09 Apr 2011, 20:19, edited 3 times in total.
User avatar
laoliveirajr
 
Posts: 7
Joined: 07 Jan 2011, 02:09
Location: Brasilia, DF, Brasil

Re: Im learning the chess engines programming, with the Capi

Postby laoliveirajr » 09 Apr 2011, 19:26

Im learning the chess engines programming, with the Capivara

What programming language to use?

The TSCP, which I derived the Capivara was written in C. The chess engine TSCP is a textbook example, well programmed by Tom Kerrigan. It is difficult to make changes in your native code, it will always seem that the original code is better than the derivation.
I always remember Tom Kerrigan's suggestion, that I should write my own code, then I was resolve the rewrite code in another programming language, before, and then make my new experiences.
The first language that came to mind was PASCAL, because after the first steps in BASIC (with numbered lines), I learned algorithms with Pascal, my natural language.
I tried to translate the code, but what I thought the first I will do? I want a chess engine running in 32bit and 64bit on multicore processors. The yet to 64bit Delphi and FreePascal/Lazarus are still lacking some features desirable to implement ...
Then I asked for some advice to my supervisor teacher of my thesis at the University, and he suggested that I implement a minimax/negamax search tree with a speech focused on parallel programming language such as functional Hakell. I made some attempts, and convinced myself that learning Haskell was not a good contract, because processing was not faster, but more slower ... But the idea of using a dedicated parallel processing continued to be a great idea. And I found the Axum programming language, which faces the prosess multicore, and its base is similar to C#.

You must use the programming language that best suits your needs for demand.

Lourenço
User avatar
laoliveirajr
 
Posts: 7
Joined: 07 Jan 2011, 02:09
Location: Brasilia, DF, Brasil

Re: Im learning the chess engines programming, with the Capi

Postby Ron Murawski » 11 Apr 2011, 00:29

laoliveirajr wrote:What programming language to use?


You seem to be interested in concurrency, so I will begin with some languages with good built-in concurrency support.

Erlang has concurrency built in, but the language syntax seems awkward to me.
http://en.wikipedia.org/wiki/Erlang_%28 ... anguage%29

You can get the same built in concurrency using Scala on the jvm. If you use the Akka library the concurrency details become fairly simple. It is possible to use Java and Akka to achieve the same goals.
http://www.scala-lang.org/ (Scala)
http://akka.io/ (Akka)

For massive concurrency it is necessary to program in a functional manner. If you are an imperative programer you will find the switch to functional programming to be difficult, at least I found that to be the case. Scala is nice in that it supports both imperative and functional programming. There's an excellent Scala book available written by the language creator.

You will find that trying to add concurrency to chess is very difficult. Chess is not a concurrency-friendly problem. The best concurrency domains are those in which each thread is doing work that is totally independent of all the others, such as one thread per communications socket. Chess is very sequential and poorly written threading will cause much time to be lost while waiting for items to be calculated by other threads before a waiting thread can do useful work.

You mention that you like C# syntax. You can program in C# and not suffer the slowdown caused by running on the .NET virtual machine by using Vala.
http://en.wikipedia.org/wiki/Vala_%28pr ... anguage%29
Although Vala is tied to the glib library, it is a totally cross-platform solution. There are Vala libraries being developed so Vala is not dependent on any external libraries. Concurrency is not built-in, but you get threading support.

Another possibility is Felix, but you don't get support for classes. No concurrency, but with thread support.
http://en.wikipedia.org/wiki/Felix_%28p ... anguage%29

HTH,
Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Im learning the chess engines programming, with the Capi

Postby vbce » 22 Apr 2011, 16:25

Hello,
I have a question (maybe more later :-), if my opening book is small, the search couldn't find a move from the book, what move I am looking for? what "method/strategy" would I apply?
Please advice.
Thank you
vbce
 
Posts: 7
Joined: 10 Mar 2011, 06:46

Re: Im learning ... [opening book question]

Postby Dann Corbit » 22 Apr 2011, 21:23

vbce wrote:Hello,
I have a question (maybe more later :-), if my opening book is small, the search couldn't find a move from the book, what move I am looking for? what "method/strategy" would I apply?
Please advice.
Thank you


When you say "The search couldn't find a move from the book" -- this needs to be clarified.
For example, if the book move appears to be illegal according to your engine, then there are two possibilities:
1. Your engine's move generator has a bug
2. The book has a bug
If it is the book that has the bug, then fix the book. If it is the engine that has the bug, then fix the engine.

On the other hand, perhaps you mean that your engine analyzes for a long time and never discovers the same move as that suggested by the book as a best move.
In this case, the question is:
Do I trust my engine more or do I trust the book more?
If you trust your engine more, then discard the book move and use the engine move.
If you trust the book more, then discard the engine move and use the book move.

Perhaps you mean something else. Can you please clarify exactly what you mean by:"The search couldn't find a move from the book"
Dann Corbit
 

Re: Im learning the chess engines programming, with the Capi

Postby vbce » 23 Apr 2011, 04:28

Hello,

...perhaps you mean that your engine analyzes for a long time and never discovers the same move as that suggested by the book as a best move.....
....If you trust your engine more, then discard the book move and use the engine move...

That was exactly my question, in that case, how do I generate "engine move" ? what method/strategy do I need to learn / use? Sorry about my awful English.

Thank you very much for your responded.
vbce
 
Posts: 7
Joined: 10 Mar 2011, 06:46

Re: Im learning the chess engines programming, with the Capi

Postby Dann Corbit » 23 Apr 2011, 12:40

Probably, you want this place:
http://chessprogramming.wikispaces.com/
Dann Corbit
 


Return to Chess Programming Lessons

Who is online

Users browsing this forum: No registered users and 0 guests