Othello / Saving Boards / Hash Table

Started by
3 comments, last by Zahlman 18 years ago
Hi, I´m doing a othello game with minimax, i was thinking if there is a way to store a board, without doing piece by piece, so i can check if another board is the same as the one i saved, and then i would save those boards into a hash table, but i don´t know much about hashing.. Anyway, if there is a way to store the board except being it to store each piece at a time, it would be a lot easier. I did a matrix to store the boards, its like the Y represents how much pieces are on the board and the X how much white pieces are on the board, so it would be easier to tell the apart, but even so in a 4x4 board there some positions of the matrix that store 500 to 1000 boards making it slower than if i didnt try to locate those nodes that i already calculated. Thank you for your attention..
Advertisement
Othello is played on a 8x8 board, 64 tiles total. You can use a 64-bit number to encode where all black pieces are. Another 64-bit number stores where all white pieces are. You can then use some well-known hashing algorithm to hash the full 128-bit number (which represents the game situation) into desired range, e.g. 0-9999 for a hash table with 10000 elements.
Also: http://en.wikipedia.org/wiki/Hash_table
Thanks guys, i will look into that! =]
You might also want to investigate Zobrist hashing - I'm told it's popular for chess programs, at least.

This topic is closed to new replies.

Advertisement