You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there is a bug in the VictoryFor function which results in the moment when the computer places its sign in the [0,2] [1,1] [2,0] fields, it is a tie instead of the computer winning.
I think this is because those two if's give the same result if board[rc][rc] != sgn: # check 1st diagonal cross1 = False if board[2 - rc][2 - rc] != sgn: # check 2nd diagonal cross2 = False
In my opinion, the function is better to look like this
` for rc in range(3):
if board[rc][0] == sign and board[rc][1] == sign and board[rc][2] == sign: # check row rc
return winner
if board[0][rc] == sign and board[1][rc] == sign and board[2][rc] == sign: # check column rc
return winner
if board[0][0] == sign and board[1][1] == sign and board[2][2] == sign:
return winner
if board[0][2] == sign and board[1][1] == sign and board[2][0] == sign:
return winner`
The text was updated successfully, but these errors were encountered:
I think there is a bug in the VictoryFor function which results in the moment when the computer places its sign in the [0,2] [1,1] [2,0] fields, it is a tie instead of the computer winning.
I think this is because those two if's give the same result
if board[rc][rc] != sgn: # check 1st diagonal cross1 = False if board[2 - rc][2 - rc] != sgn: # check 2nd diagonal cross2 = False
In my opinion, the function is better to look like this
` for rc in range(3):
The text was updated successfully, but these errors were encountered: