4 ms·
This is a tangent, but checking if all the elements in the diagonal position are the same is not sufficient. You also need to check that any of the elements are
by polyomino 2y ago
This is a tangent, but checking if all the elements in the diagonal position are the same is not sufficient. You also need to check that any of the elements are not '-'.
- bowmessage 2y agoThat’s… what the article says.
- deleted 2y ago[deleted]
- cpfohl 2y agoTo be fair to parent I read the whole thing and also missed that.
- nothrabannosir 2y agoThat’s not what the article says. The last paragraph: if (cell[0][0] == cell[1][1] == cell[2][2]) { return Winner } > Well the code is indeed correct . Well done, Python… for finding yet another way to confuse us all. The code is incorrect: if all entries are '-' there is no winner. Even ignoring the braces…
- freehorse 2y agoYou do not know how the game was implemented to assume that.
- deleted 2y ago[deleted]
- solveit 2y agoDepends how the flow goes. It's reasonable to only check the diagonal when one player has actually played on the diagonal, in which case this is fine.