where to start chess programming?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
elcabesa
Posts: 677
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: where to start chess programming?

Post by elcabesa » Sun Jun 22, 2014 8:14 pm

I'll try to sare my experience with you.
I started many years ago programming a chess engine and created my first playing program in c# after few month. I tought I have understood everything about chess programming and added everything looks good. The engine played at 1400 elo point rating and everything I tried didn't work.
few years later a good boy created a tutorial about chess programming, the tutorial was called writing a chessprogram in 99 point and the final program was called winglet. The program wasn't strong at all, maybe less than 2000 but explained very well the basics of chess programming. studying this program and his code I created my second engine and some his code is still nside my code.
now I am on my third engine and I know that at the time of my first engine I hadn't understood anything. I still miss lots of things but my engien is nowadays in the 2850 elo point range.

The algorithm under the hood of the engine are not easy to fully understand, when you think you understood verything you found a bug in your code and you understood you have understimated the difficulty of putting everything together.

one iportant thing is to write easy code and bug free code.

elcabesa
Posts: 677
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: where to start chess programming?

Post by elcabesa » Sun Jun 22, 2014 8:54 pm

since you ask us "where to start" I'll try to say what I think could be logical way to start chessprogramming

1) board rapresentation
2) parsing a fen string and displaying the board position
3) definition of move rapresentation
4) code to do/undo a move
5) if you like you could write a code to detect if a move is valid or more easily if a position is valid ( you cannot leave the king in check)
6) move generator
7) writing /debugging perft of some position.
8) writing a very easy board evalutation { material counting}
----------- up to know you only have don propedeutic work-------
9) write an easy alphabeta searcher
10) implementing a protocol to command your engine (uci/winboard are the most used)

from there you can start your REAL chess programming adventure.

User avatar
vittyvirus
Posts: 641
Joined: Wed Jun 18, 2014 12:30 pm

Re: where to start chess programming?

Post by vittyvirus » Mon Jun 23, 2014 4:43 pm

elcabesa wrote:since you ask us "where to start" I'll try to say what I think could be logical way to start chessprogramming

1) board rapresentation
2) parsing a fen string and displaying the board position
3) definition of move rapresentation
4) code to do/undo a move
5) if you like you could write a code to detect if a move is valid or more easily if a position is valid ( you cannot leave the king in check)
6) move generator
7) writing /debugging perft of some position.
8) writing a very easy board evalutation { material counting}
----------- up to know you only have don propedeutic work-------
9) write an easy alphabeta searcher
10) implementing a protocol to command your engine (uci/winboard are the most used)

from there you can start your REAL chess programming adventure.
just the answer i was looking for. now i have some queries ( please dont tell me to post a new forum topic )... i have done board representation system, and i today programmed a knight move generator. my code can be better, but for now i am focusing on keeping things simple. i have done upto here on my own, completely. others code is simply damn hard to get. coming to ky queries, what does step 4 ie definition of board representation mean??. and what do u mean by perft??? i am not new to chess programming , i know a lot of theory ( i could see u translate board evaluation for me) but looking at you guyz, i feel completely dumb.... -_-
'I would only believe in a god who could dance.' - Friedrich Nietzsche

User avatar
michiguel
Posts: 6264
Joined: Thu Mar 09, 2006 7:30 pm
Location: Chicago, Illinois, USA
Contact:

Re: where to start chess programming?

Post by michiguel » Mon Jun 23, 2014 5:00 pm

vittyvirus wrote:
elcabesa wrote:since you ask us "where to start" I'll try to say what I think could be logical way to start chessprogramming

1) board rapresentation
2) parsing a fen string and displaying the board position
3) definition of move rapresentation
4) code to do/undo a move
5) if you like you could write a code to detect if a move is valid or more easily if a position is valid ( you cannot leave the king in check)
6) move generator
7) writing /debugging perft of some position.
8) writing a very easy board evalutation { material counting}
----------- up to know you only have don propedeutic work-------
9) write an easy alphabeta searcher
10) implementing a protocol to command your engine (uci/winboard are the most used)

from there you can start your REAL chess programming adventure.
just the answer i was looking for. now i have some queries ( please dont tell me to post a new forum topic )... i have done board representation system, and i today programmed a knight move generator. my code can be better, but for now i am focusing on keeping things simple. i have done upto here on my own, completely. others code is simply damn hard to get. coming to ky queries, what does step 4 ie definition of board representation mean??. and what do u mean by perft??? i am not new to chess programming , i know a lot of theory ( i could see u translate board evaluation for me) but looking at you guyz, i feel completely dumb.... -_-
https://www.google.com/?gws_rd=ssl#q=perft

Miguel

User avatar
cdani
Posts: 2047
Joined: Sat Jan 18, 2014 9:24 am
Location: Andorra
Contact:

Re: where to start chess programming?

Post by cdani » Mon Jun 23, 2014 5:47 pm

Also for board representation:

https://chessprogramming.wikispaces.com ... esentation[/url]

elcabesa
Posts: 677
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: where to start chess programming?

Post by elcabesa » Mon Jun 23, 2014 7:52 pm

vittyvirus wrote:
elcabesa wrote:since you ask us "where to start" I'll try to say what I think could be logical way to start chessprogramming

1) board rapresentation
2) parsing a fen string and displaying the board position
3) definition of move rapresentation
4) code to do/undo a move
5) if you like you could write a code to detect if a move is valid or more easily if a position is valid ( you cannot leave the king in check)
6) move generator
7) writing /debugging perft of some position.
8) writing a very easy board evalutation { material counting}
----------- up to know you only have don propedeutic work-------
9) write an easy alphabeta searcher
10) implementing a protocol to command your engine (uci/winboard are the most used)

from there you can start your REAL chess programming adventure.
just the answer i was looking for. now i have some queries ( please dont tell me to post a new forum topic )... i have done board representation system, and i today programmed a knight move generator. my code can be better, but for now i am focusing on keeping things simple. i have done upto here on my own, completely. others code is simply damn hard to get. coming to ky queries, what does step 4 ie definition of board representation mean??. and what do u mean by perft??? i am not new to chess programming , i know a lot of theory ( i could see u translate board evaluation for me) but looking at you guyz, i feel completely dumb.... -_-
I realy can't understand your message. Someone has already pointed you to a link where perft is explained and another one to a link with board representation :)

what you know what step 4 is? doing/undoing a move. when you do a move you modify the board status when you undo a move you return to the precedent status.

User avatar
Bo Persson
Posts: 174
Joined: Sat Mar 11, 2006 7:31 am
Location: Malmö, Sweden

Re: where to start chess programming?

Post by Bo Persson » Mon Jun 23, 2014 9:30 pm

vittyvirus wrote:I'm sorry if i was being a fool, seriously. i know these situations where people ask u for clear answers when they dont know much about it, and i guess m being among those people as many experienced people are here. You guyz are really tough.
You are asking for a short summary of a field that has produced academic papers for decades.

http://chessprogramming.wikispaces.com/Papers

This would be several bookshelves full, if on paper. How are we going to give a short, but "expanded", summary of this? It's just not possible.

You have to ask very specific questions to get more usable answers. The upside is that you CAN get answers from people who are very experienced and have worked with this for 30 years or more!

User avatar
Steve Maughan
Posts: 1025
Joined: Wed Mar 08, 2006 7:28 pm
Location: Florida, USA
Contact:

Re: where to start chess programming?

Post by Steve Maughan » Mon Jun 23, 2014 10:56 pm

Take a look at my website - it has a "over the shoulder" view of writing a decent chess engine:

http://www.chessprogramming.net

Steve
http://www.chessprogramming.net - Maverick Chess Engine

User avatar
vittyvirus
Posts: 641
Joined: Wed Jun 18, 2014 12:30 pm

Re: where to start chess programming?

Post by vittyvirus » Tue Jun 24, 2014 11:30 am

@bo persson
people with 30 years of experience are rare, i dont know anyone except dr. hyatt but he IS my hero. i wish he would see this and respond.
@ steve maughan
i took a peak at ur website a month ago. it is nice. thanks!!
@ daniel jose
i know what board representation is, i have implemented it too. on marco belli's scale, i have done first 3 steps completely.
@ marco belli i'm sorry for writing 4 instead of 3. i thought u meant something special by 'definition of move representation' that was not representing the moves.
@ miguel ballicora
thank you!
'I would only believe in a god who could dance.' - Friedrich Nietzsche

elcabesa
Posts: 677
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: where to start chess programming?

Post by elcabesa » Tue Jun 24, 2014 4:56 pm

you write " what does step 4 ie definition of board representation mean??." :)
I mean decide how to represent a move. you have to save the move after generating it. normally you have to save from, to and special move information (promotion, en passant ,castle), or something equivalent.

Post Reply