Jump to content
  • Advertisement
Sign in to follow this  
mind in a box

Too many Zobrist-Numbers

This topic is 2280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
I am not sure what "blocks" and "buildings" are.

What are all the things that a cell might contain?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!