Page 1 of 1

Hello from a new member

Posted: Sat Nov 01, 2014 2:26 am
by ppyvabw
Hi,

I have just joined, in the hope that this site be of help to me in writing my own chess engine. I am fairly fluent in c and c++, but I am by no means a fully-fledged programmer -- just a mere physicist.

I have two previous iterations of the engine I am trying to write, the last one being a big improvement over the first -- in so much as it actually plays chess -- but still not really very good. It did manage to solve positions though, so it worked!

I'm in the middle of my third attempt. I am building my current engine around the same c++ class to represent the board that my previous attempt used, because I know it works -- in so much that along with my move generator I am getting correct PERFT results, although I think it may be a little slow. Currently Perft(6) takes about 60 seconds. I set Perft(8) going before I went to work the other day and it had still not completed by the time I got home, so I switched it off. I haven't tried 7 yet. (Someone is probably going to tell me that this is very slow lol.) The class uses a 12*12 rep of the board (in the form of a 1*144 array) with a border for easy edge detection (I guess 12*12 is not standard practice), and it generates dynamically allocated piece lists and iteratively updates the hashkeys and what not.

My current problem is as follows. In my second attempt, I generated the moves by looping through the piece lists and attributing a score to each move based on the hash table and killer and history heuristic and what have you, and tried to use an insertion sort algorithm to sort them 'on the fly'. This worked, until I tried to implement a static exchange evaluation which screwed up the order of the piece lists, and subsequently screwed up the move generator. So I was having to generate all the moves, then loop through them all again to sort them, which slows stuff down. I guess the solution would be to write a copy constructor for my board class, so that I can call SEE without changing the piecelists, but I don't think that's a trivial matter in my case owing to my use of dynamically allocated stuff. As I say, I am not a programmer.

Other problems I have had previously that I would like to solve with this iteration are time control and interfacing with a GUI -- I suppose the latter is just a programming issue rather than a AI theory one, but it's still something I'd struggle with atm . And also, tuning my evaluation function, but I guess that comes down to playing a lot of games with it, which I can't really do by myself lol.

Thanks anyway, and hope to be able to get involved on this forum.

Re: Hello from a new member

Posted: Sat Nov 01, 2014 11:05 am
by Adam Hair
Hi! It is always good to see a new engine author. There are several experienced authors who check into this forum from time to time who can answer your questions. Other places where engine authors congregate are Computer Chess Club and Winboard forum. Also, I have compiled a list of computer chess programming resources that may be of use to you.

Re: Hello from a new member

Posted: Thu Nov 06, 2014 7:22 pm
by mjlef
Most programs order by smallest piece capturing biggest, a high score for the hash move (or generated first before the others), then non caps by history score. Since doing an SEE is very expensive, most programs only do this as each move comes up. If the SEE is bad, you drop the "bad" moves into another move list, and finish searching the other good moves. Finally, you search the "bad" move list. You can look at say Fruit source code to see how to do this. It can be a huge time saver.