-
4 Comments
It seems to me that this solution unintentionally messed up its last code line and got lucky with the test suite, because this solution would not correctly identify x = [1,0,0; 0,0,0; 0,0,0] or x = [-1,-1,-1; 1,1,0; 1,0,0] as valid Tic-Tac-Toe states. Unless your very purpose was to actually expose/exploit this "shortcoming" in the test suite, of course! :-)
Thanks for your comment. I was confused by the original problem description such as "state 0: legal 1: this state", where the extra colons seem to be misleading. After some digging, I have figured out the rationale of Tic-Tac-Toe, and thus, updated my solutions.
Thanks for your reply, Peng Liu. I'll admit, I too was (and still am) confused by the "state 0: legal 1: this state" sentence in the problem description. Luckily I was already familiar with the Tic-Tac-Toe game.
Hi, yurenchu & Peng Liu. I agree the punctuation and syntax are very confusing, and indeed misleading. As written it seems to define 0 as representing legal states — which, besides being unusual (although possible), is contrary to the Test Suite and the example above. A clearer way to state the sentence may be: "For this challenge please categorise the given board state as either 1 = legal state, or 0 = illegal state (cannot occur in a game)."
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!