I’m creating a item crafting system for a game and need to be able to take any random selected items that a player could select and transform whatever items selected into a hash_tag which can then be compared to all the hash_tags from all item-mixes possible, searching for a correct match. This should be the simplest and fastest means to get the result I’m looking for, but of all other ways of doing this sort of thing (I’ve experience with just about all of them), hash tags are the one thing I’ve never even slightly touched. I’ve no idea where to even begin, and could use a lot of help with this.
Basically what it needs to do is allow the player to select anything he or she has, combine the selected things into a hash_tag and check the hash tag board for that number. Whether or not that number results in a “valid combination” or a “this is not a valid combination” doesn’t matter, so long as all possible mixes are available on the hash tag board.
On the side there’ll obviously be some code for picking things and removing them if there’s a valid match and adding in the new item instead, but that’s not what I need help with.
(Although anyone with suggestions on this I’ll be glad to hear them!)
From what I have gathered so far you have an ordered list of inputs
(the items being crafted) and are looking for a function that returns
a hash (probably for easy comparisons and storage) and also has the
property of being reversible.
Such a thing cannot exist for the general case as long as your hash
has less bits than your input data hashing will produce collisions and
with those collisions the backward transformation will be impossible.
A good start would be just to choose unique identifiers for each item
and use a list of those identifiers(order them by size if order is
irrelevant to the crafting) as the hash. Comparison will still be
reasonable fast.