I am trying to decide which programming language to use for my chess project. I am leaning towards Java because that is the language I know best.
This from the Chess Programming Wiki...
"Java has no unsigned long data type that is e.g. used by bitboards. Thus developers have to handle the bits slightly differently."
How different is "differently"? The CPW doesn't go into details
Bitboards and Java
Moderators: hgm, Rebel, chrisw
-
- Posts: 88
- Joined: Thu Oct 06, 2016 9:17 pm
- Location: India
Re: Bitboards and Java
I think the only thing you'll have to handle differently is the bit shifting. You want to use `>>>` for unsigned (logical) right shifting so your bitboard doesn't get populated with 1s from the most significant bit end if it originally was set.Fguy64 wrote:I am trying to decide which programming language to use for my chess project. I am leaning towards Java because that is the language I know best.
This from the Chess Programming Wiki...
"Java has no unsigned long data type that is e.g. used by bitboards. Thus developers have to handle the bits slightly differently."
How different is "differently"? The CPW doesn't go into details
Not sure if anything else is different.
-
- Posts: 4
- Joined: Thu Jan 01, 2015 12:21 pm
Re: Bitboards and Java
Yup, you should be fine if you just use >>> instead of >>.
In case you're interested you can check out my java chess engine (WIP):
https://github.com/etherblood/Chess/tre ... /src/chess
In case you're interested you can check out my java chess engine (WIP):
https://github.com/etherblood/Chess/tre ... /src/chess
-
- Posts: 814
- Joined: Sat May 09, 2009 4:51 pm
- Location: Toronto
Re: Bitboards and Java
Thanks. I'll bookmark your java engine for future reference.Philipp Bach wrote:Yup, you should be fine if you just use >>> instead of >>.
In case you're interested you can check out my java chess engine (WIP):
https://github.com/etherblood/Chess/tre ... /src/chess
My engine is a long way off. I need to brush up on my Java first. It'll probably be a couple of months before I get started on my program. I hope to eventually have more than just an engine. PGN Database, FICS client etc. This will be a long term project
-
- Posts: 2250
- Joined: Wed Mar 08, 2006 8:47 pm
- Location: Hattingen, Germany
Re: Bitboards and Java
yep, unsigned right shift is the issue - since otherwise arithmetical shift right would fill in the most significant sign bit instead of zero. CPW should be more clear now.Fguy64 wrote:I am trying to decide which programming language to use for my chess project. I am leaning towards Java because that is the language I know best.
This from the Chess Programming Wiki...
"Java has no unsigned long data type that is e.g. used by bitboards. Thus developers have to handle the bits slightly differently."
How different is "differently"? The CPW doesn't go into details
-
- Posts: 160
- Joined: Sat Jan 28, 2017 1:29 pm
- Location: The Netherlands
Re: Bitboards and Java
Another thing to keep in mind is that if you want to check if any value within the bitboard is set, you should not use > 0 but != 0.