View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

82 replies to this topic

### #81patishi  Members

Posted 23 July 2013 - 11:45 AM

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..      Actually on my 2.1 GHZ laptop  with DDR3 memory (1333 )  it is  a little bit faster

Edited by patishi, 27 July 2013 - 08:09 AM.

### #82rehevkor5  Members

Posted 18 January 2016 - 05:06 PM

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.

### #83Tom Sloper  Moderators

Posted 18 January 2016 - 05:53 PM

Please don't resurrect ancient discussions. Closed.
-- Tom Sloper
Sloperama Productions
Making games fun and getting them done.
www.sloperama.com

Please do not PM me. My email address is easy to find, but note that I do not give private advice.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.