Hi all. I am sorry for the post flood i am doing here lately today's topic: Transposition table for my connect 4 game.
I am programming in java and when looking for a scheme to hash a board (array of 42 ints: 1 for white, 2 for black and 0 for empty) i first tried
to put it in a long number.. but java won't let me to have a long number with 42 digits (even the LONG type). It says that it is: out of range (??)
sooo.. I am now doing it another way: i am "casting" this 42 int array into a string instead of a number, that means everytime i want to hash a board, i pass through all the array indexes and if the current index in the array is 1 , i concatenate "1" to the string...and so on until i finish.
In the end i get something like this: "12200011"... etc'. and after i done with this operation ,i take this string and using the java Hash() function, i am giving it a hash number. this hash number is the key code for the board in my TT.
what do you think about this scheme? I read about zobrist keys but i just couldn't understand how exactly i should parse a board of 42 ints (1,2 or 0) into a number of 42 digits / charachters / bits... whatever.
I wish i could just do 12200001 etc', than it would be simple and unique, but i cant
I know that working with strings like i do takes a lot of time, and i am also not sure if the hahing is good / unique. I will be very very glad if any of you can help me thourgh it (cause i am a total noob ) and guide me on what is the best way to hash a board position.
Thanks in advance!