top | item 42038027

(no title)

polyomino | 1 year 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 '-'.

discuss

order

solveit|1 year ago

Depends 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.

bowmessage|1 year ago

That’s… what the article says.

nothrabannosir|1 year ago

That’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…

cpfohl|1 year ago

To be fair to parent I read the whole thing and also missed that.