6 kyu
Tic-Tac-Toe
332 of 333timmontague
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Description must contain a rule about a boards where any move will be fail. Wasted so many attempts to know that function must return any free point (not -1, null, false or undefined).
I must return index of the move right 0-8 || -1? Then why it shows some kind of error...
fun kata. I just don't understand why it is 6kyu and the other - simple result-checker kata - is 5 kyu. I think this kata looks a step further. It is fine for a 6kyu just I find the other one simpler. nvm
Hi!
Written tests allows to push partial kata solution
just look at my terrible solutions, wich passed the tests.
suggest add this case:
There's a problem with the random tests. In almost all cases, there will be at least one test with no solution. A couple examples I've encountered below:
Oh, right, it's already a winning board.
I'e changed the random tests so it only generates non-winning boards.
Approved
Just lol'd.
Oops, forgot to check reply type ;-)
Needs random tests and example tests but good kata :)
@matt c: As the author has been inactive since November 2014 can you please add the random tests? Thanks, suic
Fixed
Ok, I didn't understand that we only have to return a valid move. I used to return all winning or possible moves.
I also assumed we had to make the "best" move possible. The description isn't all that clear about what is required.
I would like to see someone solve this using a brute force recursive function.
Thanks, fixed that too. Also another bug I had.
Now my solution fails on your last case :p
['X', 'O', '', 'O', 'X', '', 'X', 'O', '']
i.e.for which you accept 2, 7 but I think you meant 2, 8.
You are correct, I missed that one!
I don't understand why 8 isn't a valid answer for
['', 'X', 'O', 'O', '', 'O', 'X', 'X', '']
isn't thatwhich has both 4 and 8 as winning positions?