[SOLVED] Hashing Magic Ain't Doing No Magic

# Use the hash function to find places for soldiers.
totalCells = 135

# This function hashes a string value to an integer.
def hashName(name):
    hash = 0
    for i in range(len(name)):
        letter = name[i]
        hash += ord(letter)
    # The hash value should be from 0 to 134.
    # Use modulo operation to "cut" the hash value.
    return hash % totalCells

soldiers = hero.findByType("soldier")
# For each soldier say his/her name (id) and hash of it.
# The name and the number should be splitted by whitespace.
for soldier in soldiers:
    hero.say(soldier.id +' '+hashName(soldier.id))

The code seems fine, but my man Guan Yu doesn’t move even tho my hero said his ID and his Hash Name. BUG???

Your code is identical to mine and I ran both just to test; both completed fine.

My first thought is the space in the Guan Yu’s name…at least every time I’ve ran the level, my guys were always a single name. How about trying a different browser? At a minimum, this will force a new seed.

You can also just try and Submit. It will give a different seed that way.

I ran into the same problem though with Jun Fan. I would tend to agree that is is a bug. The space seems to mess up the count. I did see another name that was hyphenated and it didn’t create a problem. I tried several submissions and they all seem to pass, but when I restart the level from the map the default seed is the same with the Jun Fan problem.

just submitted, it worked! Just a bug