Well. Truth is, the code for handin is just broken. The return code does, sort of, what it *should be* doing. Handin does: "For every key+value in what I was given, is there an *identical* key+value in what I need?" No attempt is made to check if its the right item, but you just have too many. Item_return does: "For every key in what I am given, start with 0 items, and increment until I exceed the *value* of that key."
The code needed for handin is kind of more complicated though. It needs to combine its "did it exist at all", with its, "is it a match or not", parts, so that you do something like:
Code:
for every KEY in what I want do
Is there a key in what I was given that matches?
yes - is the value > than, = to, or < than what I need?
if equal, delete both keys and continue.
if >, then delete the hash key and decrease the given one by the hashes value.
if <, then delete the given key, subtracting its value from the hash, and return to step 2.
no - exit with fail.
When you run out of keys and values in the hash, you pass what ever is *left* of the given items to return_items.
The existing code works perfectly, as long as you don't turn in stacks, or your stacks are the *exact* size passed to the test, but otherwise, it just doesn't work as written.