def expand(node):
tried_sub_node_states = [
sub_node.get_state() for sub_node in node.get_children()
]
new_state = node.get_state().get_next_state_with_random_choice()
# Check until get the new state which has the different action from others
while new_state in tried_sub_node_states:
new_state = node.get_state().get_next_state_with_random_choice()
by add below codes will correct the error.
class State(object):
.....
def __eq__(self, other):
if isinstance(other, self.__class__):
return (self.current_value, self.current_round_index, self.cumulative_choices) == \
(other.current_value, other.current_round_index, other.cumulative_choices)
else:
return False
def __hash__(self):
return hash('{},{},{}'.format(self.current_value, self.current_round_index, self.cumulative_choices))