alpha-zero-general
alpha-zero-general copied to clipboard
Possible wrong code?
https://github.com/suragnair/alpha-zero-general/blob/5156c7fd1d2f3e5fefe732a4b2e0ffc5b272f819/connect4/Connect4Logic.py#L77
This is the judgement of whether player has won in horizontally in connect4. But I prefer it should be len(player_pieces[0]) - self.win_length + 1
Looks right. It's also not checking vertical win, as you pointed out. Very confusingly written code.
@WangChuanYuan Apparently fortunately the code wouldn't break, since if you loop too far, the last check starting at len(player_pieces) - self.win_length + 2
is only self.win_length - 1
-long, and won't return true.
@yunjiangster The code does check for vertical win here -- sorry I don't know how to embed a line of code in an existing issue.