Hello everyone - as the title says I'm a bit puzzled by the lack of hashtables or its equivalent (at least from what I've gathered). Could anyone more experienced in these matters enlighten me about this please? :( I grew so fond of Hashtables while mapping in Warcraft 3 and now I'm finding it hard to make anything decent without them.
Unless someone else can show us where this data structure is already implemented just do what I did and implement your own hash table and hashing algorithms using fixed arrays.
A hash table uses a hashing function to store key/value pairs where the key is unique. They are rather useful in programming since you can rapidly store things by an attribute instead of index.
Example where keys are names and values are ID numbers
hash h
h{"John"} = 2836716
h{"Bob"} = 2918222
print( "The ID of Bob is:" + h["Bob"] )
Can be implemented in pretty much any language as long as you have a good hash function. This includes SC2.
Hello everyone - as the title says I'm a bit puzzled by the lack of hashtables or its equivalent (at least from what I've gathered). Could anyone more experienced in these matters enlighten me about this please? :( I grew so fond of Hashtables while mapping in Warcraft 3 and now I'm finding it hard to make anything decent without them.
Unless someone else can show us where this data structure is already implemented just do what I did and implement your own hash table and hashing algorithms using fixed arrays.
You could use a bank. If I remember correctly it works like WC3's game cache.
Just sad that it uses strings as keys and not integer.
what exactly are hashtables anyway ?
A hash table uses a hashing function to store key/value pairs where the key is unique. They are rather useful in programming since you can rapidly store things by an attribute instead of index.
Example where keys are names and values are ID numbers
hash h
h{"John"} = 2836716
h{"Bob"} = 2918222
print( "The ID of Bob is:" + h["Bob"] )
Can be implemented in pretty much any language as long as you have a good hash function. This includes SC2.