Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def successors_of(state):
- # Generate valid moves
- valid_moves = []
- for i in range(len(state)):
- if state[i] == 1 or state[i] == 2:
- continue
- count = 1
- while count < state[i]/2:
- new_state = state.copy()
- new_state[i] = new_state[i]-count
- new_state.append(count)
- new_state.sort(reverse=True)
- valid_moves.append((count,new_state))
- count += 1
- return valid_moves
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement