Too many Zobrist-Numbers

Started by
13 comments, last by mind in a box 11 years, 11 months ago
Hi GDNet!

I was writing some Alpha-Beta-Search for a game and came to the point where I thought a transposition-table could be helpful.
The problem is not that I don't know how those are working, but more that the table of random numbers I need to generate the hash-values will get too big!

When I got it right I would have to initialize this array with random numbers to save my whole "battlefield":
__int64 ZobristNumbers [2] // [Turncolor (Player/Enemy)]
[20*5] // [Location]
[20] // [NumPlayerPoints (Max 20)]
[20] // [NumEnemyPoints (Max 20)]
[2] // [PlaceOwner]
[4][5] // [PlayerCards]
[4][5]; // [EnemyCards]


So:
2*20*5*20*20*2*4*5*4*5 = 64000000
64000000 * 64bit = 4096000000 bytes = 4000000kbyte = 3906,25mbyte

And almost 4GB of memory are just too much. Is there any help for me or should I just drop the transposition-tables?

Regards,
Mind in a box
Advertisement
You need to compute a hash key of a position in your game. For some games, a Zobrist key is a very convenient way to go about it, but perhaps this isn't the case for your game.

Can you describe what a position in your game looks like?

EDIT: Also, your Math seems wrong: 2*20*5*20*20*2*4*5*4*5 entries * 8 bytes/entry ~= 488 MB
Basically I have a field of 4*5 positions to set on. The players can put their marks on those, and the player who got more marks than the other owns the field.
Also every player has 4 cards, describing on which of the 5 fields they can set.
You can compute a hash key for the board in the usual way, XORing together numbers from a table of size [2][4*5*5] or something like that. Then you can compute a hash key of the cards, and the details depend on things like whether you may have more than one card of one type or if they are distinct. Then you can combine both hashes by XORing them together.
Why do I not need the number of marks they have? And do I XOR the hash of the cards to the hash of the field then or do I store both separately?
I didn't know you could have more than one mark in each position. If you give me a complete description of the game, I'll give you a correct method for computing a hash key, but I can't guess.

Yes, you can just XOR the hash of the cards and the hash of the field, as I said earlier.
That would be very nice, indeed.

Every player has 6 blocks in their hands (That are the "marks" I was talking of). They can have a height of 1 to 4.
Now they put those blocks into the field, trying to get more than the enemy and to become the owner of the field.
When you place a block you have to look at your cards if you have the right one for the place you want to build on. They can show the rows 1 to 5.
When you place on that field you have to throw the card away, so I'd have to keep track of the cardstack too, but let's just put that aside.

After all 6 blocks were placed the players can choose 6 new ones from their library, until it is empty. (Contains 24 blocks)
You definitely need to encode the contents of the deck and of the library of blocks for each player. What is the importance of the heights?

So how many fields do you have, how many cells does each field have and what can a cell contain?

An example of position would be very helpful to understanding your description.
The game is divided in 4 parts, so the library doesn't matter, since you choose those blocks at the beginning of the parts.
As for the height: You can not build onto a block when you don't get the building afterwards.

The field is 4*5. 4 lines with 5 rows. Each cell contains one building.

But I'm starting to understand... I can generate random numbers for the cards and random numbers for the buildings and probably random numbers for the locations and just XOR them all together afterwards?
I am not sure what "blocks" and "buildings" are.

What are all the things that a cell might contain?

This topic is closed to new replies.

Advertisement