oldState.predecessor = state.predecessor;
void hashInsert(const AStarState& state) {    DEBUG0("inserting " << state);    unsigned int hash = state.hash() % hashTable.size();    DEBUG0(" hash = " << hash);    while (true) {	if (hashTable[hash] == 0) {	    DEBUG0(" hash = " << hash << " empty. Putting it there.");	    states.push_back(state);	    ++numOpen;	    DEBUG0(" pushed " << state);	    hashTable[hash] = states.size() - 1;	    return;	} else {	    AStarState& oldState = states[hashTable[hash]];	    DEBUG0(" hash = " << hash << ": " << oldState << " already there.");	    if (oldState == state) {		DEBUG0(" hash = " << hash << ": "		       << oldState << " equals new state.");		if (state.numMoves < oldState.numMoves) {		    DEBUG0(" New way to this state is shorter.\n");		    oldState.numMoves = state.numMoves;		    oldState.isOpen = true;		    ++numOpen;		    if (hashTable[hash] < firstOpen) {			firstOpen = hashTable[hash];		    }		    return;		} else {		    DEBUG0(" We already know a better way.");		    return;		}	    }	    if (++hash >= hashTable.size())		hash = 0;	}    }}