I can certainly vouch for that. I'd also add to Mr. Sarkar that somewhere along the way you just mind find that it becomes the journey, and not the destination, that becomes the prime consideration. Your project will never be finished, you will always be looking for ways to improve your engine, it might just become a lifelong hobby.hgm wrote: ...
Beware that for the first program you write, you can be 99% certain that by the time you get it running, you will not be happy with any part of it, because the skill you have acquired in the process of building it will now enable you to see how you should have approached each part of it in a fundamentally better way.
...
Guide me through building a chess program
Moderator: Ras
-
- Posts: 814
- Joined: Sat May 09, 2009 4:51 pm
- Location: Toronto
Re: Guide me through building a chess program
Re: Guide me through building a chess program
Sorry for the late answer. It's festival time here and I was away. We have chosen java as the language and we did a simple java file for representing position in Bitboard from FEN string.
Problem is the situation though . This project is not our personal venture in which case we could experiment different approaches or start slow but it's a college project which we'll have to produce within time and it has to be good (at least looking hard
) . There's marks on this project which can be 1 semester or 2 semester in duration based on how big/difficult it is. Now if we do bitboards we'll obviously take 2 sems, if array then probably 1 sem. In the later case, we'll have to take up another project next sem or improve this chess program. Can we improve upon an array chess program if we do that in current sem? If we try to implement bitboards next sem(6 months, actually much less time say 3-4 months), we'll probably end up with less time than required.
Also, I hope arrays won't make things too easy and fast, then marks may be hard to come by because some of our teachers can be totally oblivious of the effort needed for the program
Yes, I personally believe that. I am interested in chess and its programming, always have been. And now it seems more interesting than I thought. Btw, "Mr. Sarkar" sounds heavy for me. Just Sapta or Saptarshi will be fine
Everyone with experience is warning us about the difficulty regarding bitboards and we obviously have little to no experience for a big project like this. Particularly, your last paragraph really makes sense to me. We will discuss this within the next 2 days and probably will switch to an easier approach.hgm wrote:Well, I would certainly not advise bitboards for your first chess program. You would most likely still be debugging your move generator where the program would already have been able to beat you had you equiped it with a straightforward 12x16 mailbox board...Sapta wrote:Right, I forgot to say. We all are amateurs in programming. You can categorize us in the not-so-studious undergraduate studentsBut hopefully we can manage bitboards, can't say until we try
or do you suggest to use something else?
I also would not advice studying the source of an advanced and super-strong engine like Fruit until you master the basics of negamax and alphabeta, from looking at TSCP or micro-Max.
Beware that for the first program you write, you can be 99% certain that by the time you get it running, you will not be happy with any part of it, because the skill you have acquired in the process of building it will now enable you to see how you should have approached each part of it in a fundamentally better way. And then you will re-write everything. So why spend a lot of time on something you will discard almost immediately when it is finished? Try to keep it as simple as possible.
Problem is the situation though . This project is not our personal venture in which case we could experiment different approaches or start slow but it's a college project which we'll have to produce within time and it has to be good (at least looking hard


Also, I hope arrays won't make things too easy and fast, then marks may be hard to come by because some of our teachers can be totally oblivious of the effort needed for the program

Fguy64 wrote:I can certainly vouch for that. I'd also add to Mr. Sarkar that somewhere along the way you just mind find that it becomes the journey, and not the destination, that becomes the prime consideration. Your project will never be finished, you will always be looking for ways to improve your engine, it might just become a lifelong hobby.
Yes, I personally believe that. I am interested in chess and its programming, always have been. And now it seems more interesting than I thought. Btw, "Mr. Sarkar" sounds heavy for me. Just Sapta or Saptarshi will be fine

-
- Posts: 814
- Joined: Sat May 09, 2009 4:51 pm
- Location: Toronto
Re: Guide me through building a chess program
Ok Sapta. I don't always use Mr., but sometimes I use it when I speaking about someone as opposed to speaking to them. And I was actually responding to a different poster, so I used Mr., but no big deal.Sapta wrote:Fguy64 wrote:I can certainly vouch for that. I'd also add to Mr. Sarkar that somewhere along the way you just mind find that it becomes the journey, and not the destination, that becomes the prime consideration. Your project will never be finished, you will always be looking for ways to improve your engine, it might just become a lifelong hobby.
Yes, I personally believe that. I am interested in chess and its programming, always have been. And now it seems more interesting than I thought. Btw, "Mr. Sarkar" sounds heavy for me. Just Sapta or Saptarshi will be fine
TalkChess is a great forum, I'd wouldn't be nearly as far along with my project if I hadn't discovered this place.
Re: Guide me through building a chess program
Some people have been working on their non-bitboard engines for many years. I'm not sure how many hours you will be putting in for each semester but I suspect that it will be way way more than you think for a non-bitboard version.Sapta wrote:Problem is the situation though . This project is not our personal venture in which case we could experiment different approaches or start slow but it's a college project which we'll have to produce within time and it has to be good (at least looking hard![]()
) . There's marks on this project which can be 1 semester or 2 semester in duration based on how big/difficult it is. Now if we do bitboards we'll obviously take 2 sems, if array then probably 1 sem.
No, strike that, way way way way more

Andy.
Re: Guide me through building a chess program
Ok, we have talked and decided to go for an array representation. 0x88 or 16x12/16x16. But I couldn't find the latter 2 explained anywhere. Also, it seems 0x88 has most resource on net. How much of an advantage does 16x12 and 16x16 have over 0x88? I hope 0x88 boards are still viable and have not gone obsolete. If 16x12/16x16 isn't much difficult and worth the effort, a few sources explaining it would be very much appreciated. Any advice is welcome. Thank you,
Sapta.
Sapta.
-
- Posts: 28387
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Guide me through building a chess program
16x12 is basically 0x88 with a (2-wide) guard strip around the play board. This makes it slichtly faster to test for off-board moves: they don't require a separate test, because you can set it up in such a way that the codes of the 'border guards' would test the same as if you were capturing an own piece. So the tests that makes you reject such own captures, which you have to do anyway, would then automatically also reject off-board moves.
All other board-like tables (e.g. for piece-square tables or Zobrist keys) can be plain 0x88 (=16x8) format; there is no need for a guard strip there, as they will be accessed only for squares that have already been proven to map in the playing area of the board.
For an advanced move generator based on 12x16, you can for instance look at the qperft program on my website.
All other board-like tables (e.g. for piece-square tables or Zobrist keys) can be plain 0x88 (=16x8) format; there is no need for a guard strip there, as they will be accessed only for squares that have already been proven to map in the playing area of the board.
For an advanced move generator based on 12x16, you can for instance look at the qperft program on my website.
Re: Guide me through building a chess program
You might find this computer chess blog interesting. It has lots of example source code and a Chess Game Starter Kit that you can you use to start your own chess engine.
Adam Berent
www.adamberent.com
Adam Berent
www.adamberent.com
-
- Posts: 814
- Joined: Sat May 09, 2009 4:51 pm
- Location: Toronto
Re: Guide me through building a chess program
And I'll take this opportunity to make a plug for my own blog, the link is in my sig. I am not trying to represent my own programming strategy or data structures as optimal, but I do think the blog is a useful document of one person's view on the development process, from a relatively non-technical perspective.aberent wrote:You might find this computer chess blog interesting. It has lots of example source code and a Chess Game Starter Kit that you can you use to start your own chess engine.
Adam Berent
www.adamberent.com
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: Guide me through building a chess program
Very nice, thanks Adam!aberent wrote:You might find this computer chess blog interesting. It has lots of example source code and a Chess Game Starter Kit that you can you use to start your own chess engine.
Adam Berent
www.adamberent.com
Please check your en passant implementation in Board.cs, method Board::this(String FEN). There might be some copy&paste stuff to be fixed. (It is the only file I opened up to now ...)
Sven
Re: Guide me through building a chess program
hgm wrote:16x12 is basically 0x88 with a (2-wide) guard strip around the play board. This makes it slichtly faster to test for off-board moves: they don't require a separate test, because you can set it up in such a way that the codes of the 'border guards' would test the same as if you were capturing an own piece. So the tests that makes you reject such own captures, which you have to do anyway, would then automatically also reject off-board moves.
Thanks for the reply,hgm. Where can I see the codes for the tests both in 0x88 and 16x12? I wonder how own color capture is checked in 0x88

Sorry, couldn't find it on your website given in your profile. Can I get a direct link plz?hgm wrote:For an advanced move generator based on 12x16, you can for instance look at the qperft program on my website.
Ah, also you said 12x16 which seems alright to me, but why does it say 16 x 12 everywhere?
