so for university I programm the game "Pentago" in Java. Everything is fine but I stuck at a point.
Because of the AI I need to build huge Trees using alpha beta prunning. Storing the board as a 2d array or something is just to big.
So we need to save the board (6x6) as a BigInteger. I thought about transform the board into a BitSet and then save it as BigInt.
Before I just simply created a 36 characters long String with 0 for empty cell, 1 for players cell and 2 for enemies cell and it loked like this "012010012002001020102000100020102012".. Then I just used the BigInteger Constructor to create a BigInteger from this String. But I think its not the way its ment to be. Now I want to create a BitSet and use 2 Bits for every cell. like "00" - empty "01" player "10" enemy.
Can someone help me out here? I read the Documentation of BitSet and tried to use just the BitSet.set(index) method but I get weirdly negativ bigInteger values and the .toString(2) method shows something totaly diffrent I wanted to build.
Thank you guys, If I need to give you more informations or wrote anything stupid I will edit it, just let me know.
edit: or is there a better way to create a 72 bit long data, set the bits to 1 and 0 as I need and pass it into a biginteger?