Finished succesor function for state.py