For this game:
We would store the state as this:
-1 1 1
1 -1 -1
1 -1 -1
If there were any blanks squares, they would be 0;
For this challenge, given a game state, does X (1) have a three in a row on any row, column or major diagonal?
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers530
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15779 Solvers
-
Set the array elements whose value is 13 to 0
1435 Solvers
-
Piecewise linear interpolation
614 Solvers
-
Is this triangle right-angled?
6388 Solvers
-
Find the Oldest Person in a Room
20242 Solvers
More from this Author51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Solution 7 should be correct. The diagonal of -1s is a valid win.
Hope all is well with you, Doug!
@Sean, I think Doug's got it right. He's asking only if the X side (that is +1) is in a winning position. In test 7, the O side (-1) is in a winning position. So the answer given is correct.