Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __hash__method should return an integer in self.children[action] = ActionNode(self,action) #7

Open
jtsere opened this issue Mar 6, 2021 · 3 comments

Comments

@jtsere
Copy link

jtsere commented Mar 6, 2021

I get this error when I run the code. Any suggestions?

@hildensia
Copy link
Owner

Can you elaborate a bit on what exactly you tried and give the full stack trace etc.

@jtsere
Copy link
Author

jtsere commented Mar 6, 2021

I tried to run the mcts on the top of the simple maze example ([3,3]) as described in the ReadMe file. The error occurs when executing this line of code : root = StateNode(parent=None, state=MazeState([0, 0]))

@ZikangXiong
Copy link

ZikangXiong commented May 23, 2021

__hash__'s return should be int type.

Casting it before return works for me.

...
    def __hash__(self):
        return int(10 * self.pos[0] + self.pos[1])

...
    def __hash__(self):
        return int(10*self.move[0] + self.move[1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants