Anyone know what does the Problem 58. Tic Tac Toe FTW in cody mean?

1 回表示 (過去 30 日間)
tqy
tqy 2012 年 8 月 19 日
Given a tic tac toe board:
1 represents X
0 represents empty.
-1 represents O
It is X's move. If there is an immediate win possibility, choose a square for an immediate win. Otherwise return 0.
Return absolute index of the square of choice. If multiple square are valid, return them in order.
Example:
Input a = [ 1 0 1
-1 1 0
0 -1 -1]
Output wins is [4 8]
Can anyone explain it in detail?
I'm confused with the sentence I marked ans bold style.
Thanks a lot~~~

回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 8 月 19 日
"Absolute index" is "linear index".

Image Analyst
Image Analyst 2012 年 8 月 19 日
Here are the linear indexes:
1 4 7
2 5 8
3 6 9
They go down columns first, and then across rows from left to right. I don't see how [4 or 8] would be "wins." Indexes 3 and 4 would be a win for "1", while index 3 would be a win for "-1". Are you sure it says 8 is supposed to be a win for X (1)?
  2 件のコメント
tqy
tqy 2012 年 8 月 20 日
Image Analyst
Image Analyst 2012 年 8 月 20 日
It won't let me look at it. " This problem is locked. You need to solve more problems from Cody Challenge group to unlock it." Anyway, did what I say make sense to you?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by