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

Bug with checking winning condition in columns #11

Open
grainnecasey opened this issue Apr 26, 2022 · 0 comments
Open

Bug with checking winning condition in columns #11

grainnecasey opened this issue Apr 26, 2022 · 0 comments

Comments

@grainnecasey
Copy link

grainnecasey commented Apr 26, 2022

There is a bug checking winning condition in columns in this project. The following state will not be counted as a winning state even though it has been won by both players at this point (player 1 in col 0 and player 2 in col 4):
[[ 0 0 -1 0 0 0 0]
[ 0 0 -1 0 0 0 1]
[ 1 1 1 -1 -1 0 -1]
[ 1 -1 -1 1 -1 0 1]
[ 1 -1 1 1 -1 1 -1]
[ 1 -1 1 1 -1 1 -1]]

The following is the corrected column checking code, as I do not have permissions to create a PR on this repo:

			for row in range(self.board_shape[0] - self.win_condition - 1):
				column = self.__board[:, col]
				winning_set = column[row:row+self.win_condition]
				value = sum(winning_set)
				if abs(value) == self.win_condition:
					return True```
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

1 participant