Hi Guys,
I tried to use Bitset Boards to play UTTT, but I didn’t had a good experience.
My code runs slow with Bitset than with byte vector.
Below is how i did my Bitset code:
private BitSet board = new BitSet(9*9*2);
public byte getCell(byte i) {
if(!board.get(i*2+1)) {
return 0;
}
if(board.get(i*2)) {
return 1;
}
return 2;
}
public void setCell(byte i, boolean myPlay) {
if(myPlay) {
board.set(i*2+1);
board.set(i*2);
} else {
board.set(i*2+1);
board.clear(i*2);
}
}
I’m doing it correct? There is a better way to do it?