• Create Account

### #Actualturch

Posted 31 October 2012 - 07:15 AM

Its kind of hard to tell what's going on without more description....

What does the hash table store? Each tile's value? If so, I can only assume the tiles are in some sort of array to begin with, so you would be able to

	 i = 0
j = 0
for each row
for each column
hash_table.Add( ((i * numCols) + j), tile_array[i][j])
j++
i++


And since your keys are 0-255 with no gaps, why do you need a hash table? A 1-d array would serve you just as well...

Edit: from reading your previous question, I take it you are trying to generate one of 47 unique ids based on a 3x3 pattern?

### #1turch

Posted 31 October 2012 - 06:11 AM

Its kind of hard to tell what's going on without more description....

What does the hash table store? Each tile's value? If so, I can only assume the tiles are in some sort of array to begin with, so you would be able to

	 i = 0
j = 0
for each row
for each column
hash_table.Add( ((i * numCols) + j), tile_array[i][j])
j++
i++


And since your keys are 0-255 with no gaps, why do you need a hash table? A 1-d array would serve you just as well...

PARTNERS