Created
September 3, 2018 22:39
-
-
Save ltbringer/a7d4a1faf739ca2c7d8b90eba685e5a4 to your computer and use it in GitHub Desktop.
reinforcement_tic_tac_toe_snippet_3.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_game_over(self, player, item, item_x, item_y): | |
""" | |
Check if the game is over, which is defined by a row, column or diagonal having | |
the same values as the latest inserted integer `item`. | |
params | |
- item_x int: The row of the matrix in which item has been inserted. | |
- item_y int: The column of the matrix in which the item has been inserted. | |
- item int: The latest integer inserted into the matrix at row-index = item_x, and column-index = item_y. | |
""" | |
return self.cols_have_same_values(item, item_x, item_y) or \ | |
self.rows_have_same_values(item, item_x, item_y) or \ | |
self.element_diagonal_has_same_value(item, item_x, item_y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment