Hashing connect -4 board (for Transposition table)..need some help :)

Started by
81 comments, last by Tom Sloper 8 years, 2 months ago

well, from a rather rough measurment i get something like 4600000+ ...4800000 but it's constantly changing . and also, my computer (desktop) processor is rather weak (2.4 GHZ)and the memory is old and slow (DDR2) if that's count for something.. smile.png Actually on my 2.1 GHZ laptop with DDR3 memory (1333 ) it is a little bit faster

Advertisement

I would like to suggest an alternative and I think more intuitive way to calculate a hash of a connect-four position on a 6-row, 7-column board. The state of each column on the board can be represented as a bijective numeral in base 2. To construct the numeral for a column, read it from the bottom up using 1 and 2 to represent pieces of each player, and stopping when you encounter an empty position.

For example, if a column looks like (e means empty):

e

e

e

w

b

w

Then the bijective representation could look like: 121 (if 1 means white, 2 means black).

You can encode that as a binary number easily. 121 in base 10 would be 1 * 2^0 + 2 * 2^1 + 1 * 2^2 = 9. In binary, the largest value for a column will occupy 7 bits. If you have 7 bits for each of 7 columns that turns out to be 49 bits.

Please don't resurrect ancient discussions. Closed.

-- Tom Sloper -- sloperama.com

This topic is closed to new replies.

Advertisement