Alvaro,thank you for the code example. i see you put the white and black bitboards in a structure (class) named Position. so far so good, but can you kindly further explain to me what every line actually does on the encode() function?
I think maybe i will use java's BitSet class for each bitboard (white and black). The BitSet class has some nice functions that let you treat the bitset as some sort of array..
i can set a bit in a certain index just like i would in a normal array and such.. but, is it a good practice to put zero's and 1's in the bitset (array-Like ) for the making and unmaking moves??
for example, when white makes a move on a certain square, now i need to replace the 0 in his bitboard to 1 (in that certain bitboard index). how do you do that in a normal fashion way? (without using special BitSet classes). or more clearely, how do you manipulate the bits on the bitboard?
From the john tromp's page i can see that he is initializing the board array (holding the two bitboards,W&B, as Long primitives) with 0 for each one. that i understand because at the starting position no one has played yet, but after white makes a move, do i need to replace that 0 Long with another long which corresponds to a bit parttern that looks like the current state of the board? how can i know what number i need to represent the board at any given position?
EDIT: by the way, i read some more info on bits and bits manipulation and i am starting to understand the four basic bitwise operations: or,and,xor, and ~