Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualpatishi

Posted 25 June 2013 - 09:17 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


#7patishi

Posted 25 June 2013 - 09:16 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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.        like i said,  java don't let me have a long number with more than 12 digits,    it says that it is too big 
if there is a simple way of doing this without using the zobrist hashing it will be preferred for me right now,  cause i just need to get the basic idea of transposing my int array into some sort of hash number that represents it.    I wish i could just do it  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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


#6patishi

Posted 25 June 2013 - 09:14 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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).      

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.        like i said,  java don't let me have a long number with more than 12 digits,    it says that it is too big 
if there is a simple way of doing this without using the zobrist hashing it will be preferred for me right now,  cause i just need to get the basic idea of transposing my int array into some sort of hash number that represents it.    I wish i could just do it  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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


#5patishi

Posted 25 June 2013 - 09:13 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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).      

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 DID understood the random part of it,but that's not helping me if i didn't get the basic idea)      like i said,  java don't let me have a long number with more than 9 or 12 digits,    it says that it is too big 
if there is a simple way of doing this without using the zobrist hashing it will be preferred for me right now,  cause i just need to get the basic idea of transposing my int array into some sort of hash number that represents it.    I wish i could just do it  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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


#4patishi

Posted 25 June 2013 - 09:12 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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).      

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 DID understood the random part of it,but that's not helping me if i didn't get the basic idea)      like i said,  java don't let me have a long number with more than 9 or 12 digits,    it says that it is too big 
if there is a simple way of doing this without using the zobrist hashing it will be preferred for me right now,  cause i just need to get the basic idea of transposing my int array into some sort of hash number that represents it.    I wish i could just do it  12200003 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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


#3patishi

Posted 25 June 2013 - 09:10 PM

Hi all.  I am sorry for the post flood i am doing here lately smile.png      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).      

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.        like i said,  java don't let me have a long number with more than 9 or 12 digits,    it says that it is too big 
if there is a simple way of doing this without using the zobrist hashing it will be preferred for me right now,  cause i just need to get the basic idea of transposing my int array into some sort of hash number that represents it.    I wish i could just do it  12200003 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 smile.png  )     and guide me on what is the best way to hash a board position.   

Thanks in advance!   


PARTNERS