Java & Magic Bitboards
Posted: 03 Feb 2009, 15:59
Dear All,
First, let me introduce myself. I'm Laurens Winkelhagen (30) from the Netherlands. Author of Jan Willem, a C++ chess program which I stopped developing a couple of years ago.
Currently, my interest in developing a chess engine has been revived, and I've decided to give it a new go. I'm in a semi-preliminary phase, currently working on move generation. Interestingly I've decided not do return to C(++) but to try my best to build an engine that can beat me (not much of a feat, I admit) in Java.
Java?
Yes, Java. Admittedly, I mostly want to do it in java, just to see if I can and as practice for my java skills.
There are of course several drawbacks to using java (just naming 2):
On the flipside, my attempt to use the Kogge-Stone algorithm failed dramatically, for completely obscure reasons. At the bottom of this post there will be a question to the readers of this post about this;-)
Questions
I suppose you can consider the rest of this post just the introduction for the questions below.
(About Java)
1. What further complications can I expect when writing my program in Java? (as opposed to other OO languages like C++) (I expect EGTB's will give problems..).
2. Does anyone have pointers to articles about bitboard operations in Java? (so far I've found an O'Reilly article, and a bunch of pages describing efficient bitboarding for C/C++).
3. Anyone familiar with problems with the Kogge Stone algorithm in Java / perhaps with solutions? ^^
(About giving credit)
4. Some ideas are complicated in the theory, but do not really allow for independent discovery of implementations (I would name Magic Bitboards as an example). Besides giving credit to the Idea / inventor, how does one proceed with crediting the actual code? I will elaborate a little bit: In my concrete case, I've copied from this forum a list of magics, a list of shifts and a list of arraysizes, and from the chessprogramming wiki I've 'copied' the idea, including some code very similar to the code example above (http://chessprogramming.wikispaces.com/Magic+Bitboards). There is a big list of people from whom I've copied 'code' - in all probability the list of magics alone has 5+ authors .. How does one deal with that properly / Am I even allowed to copy that list?
Cheers! --Laurens.
First, let me introduce myself. I'm Laurens Winkelhagen (30) from the Netherlands. Author of Jan Willem, a C++ chess program which I stopped developing a couple of years ago.
Currently, my interest in developing a chess engine has been revived, and I've decided to give it a new go. I'm in a semi-preliminary phase, currently working on move generation. Interestingly I've decided not do return to C(++) but to try my best to build an engine that can beat me (not much of a feat, I admit) in Java.
Java?
Yes, Java. Admittedly, I mostly want to do it in java, just to see if I can and as practice for my java skills.
There are of course several drawbacks to using java (just naming 2):
- * The absence of unsigned (64bit) types / unclear (for me) complications for bitboard architectures.
- Code: Select all
private static int result(long occ, long magic, int shift){
occ *= magic;
occ >>>= shift;
return (int)(occ);
}
On the flipside, my attempt to use the Kogge-Stone algorithm failed dramatically, for completely obscure reasons. At the bottom of this post there will be a question to the readers of this post about this;-)
- * The scarcity of existing (open source) java programs.
Questions
I suppose you can consider the rest of this post just the introduction for the questions below.
(About Java)
1. What further complications can I expect when writing my program in Java? (as opposed to other OO languages like C++) (I expect EGTB's will give problems..).
2. Does anyone have pointers to articles about bitboard operations in Java? (so far I've found an O'Reilly article, and a bunch of pages describing efficient bitboarding for C/C++).
3. Anyone familiar with problems with the Kogge Stone algorithm in Java / perhaps with solutions? ^^
(About giving credit)
4. Some ideas are complicated in the theory, but do not really allow for independent discovery of implementations (I would name Magic Bitboards as an example). Besides giving credit to the Idea / inventor, how does one proceed with crediting the actual code? I will elaborate a little bit: In my concrete case, I've copied from this forum a list of magics, a list of shifts and a list of arraysizes, and from the chessprogramming wiki I've 'copied' the idea, including some code very similar to the code example above (http://chessprogramming.wikispaces.com/Magic+Bitboards). There is a big list of people from whom I've copied 'code' - in all probability the list of magics alone has 5+ authors .. How does one deal with that properly / Am I even allowed to copy that list?
Cheers! --Laurens.