I have two 3D Numpy array
win_combination = np.array([
[[0, 0], [0, 1], [0, 2]],
[[1, 0], [1, 1], [1, 2]],
[[2, 0], [2, 1], [2, 2]],
[[0, 0], [1, 0], [2, 0]],
[[0, 1], [1, 1], [2, 1]],
[[0, 2], [1, 2], [2, 2]],
[[0, 0], [1, 1], [2, 2]],
[[0, 2], [1, 1], [2, 0]]
])
and,
game_log = np.array([[1 1],[0 2],[1 0]])
I would like to compare if the game_log data matches any of the arrays in win_combination if it matches it may print True else print False.
Basically I want that if game_log == [[0, 0],[0, 1],[0, 2]] it may print True if it isn't then my code should compare another array game_log == [[1, 0], [1, 1], [1, 2]] if not then #another and so on till last and print false if there is no array that matches game_log and in this case it should print False
I have tried,
for comb in win_combination:
if game_log == comb:
print(True)
else:
print(False)
else. You don't necessarily want to returnFalseif the first element is not matching.