5 kyu
Tic-Tac-Toe (3D)
55 of 363dinglemouse
Loading description...
Fundamentals
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 says:
Four of the same symbols in a row wins
Why no information that 4 symbols in a diagonal is also a win?That's how tic-tac-toe works in 2-D.
"in a row" means "aligned", here.
I haven't seen the bug for 3 days!
python fixed tests are lists within a list, but random tests are tuples within a list. took me a bunch of debugging to figure that out.
Fixed tests in random tests as well.
Example fixed tests:
But in random tests:
done
HI EVERYONE, Im new here and I've been learning C for like 3 weeks. and I really wanna know how you guys solved this kata. I hope you give me a premission to see some ideas for soultions :) thank u.
Well, this Kata does not yet have a
C
translation, so there's your first problem...Python translation could actully help me too..
You can always see the solutions. When you didn't solve it yet, you will not get any points though.
This is apparently a board on an
X
winning move (left-0
th layer):how? I can only see a diagonal but it's split
3
-1
, is that valid?I've rewritten my solution and now apparently it's also not the one as it finds solutions such as:
which is earlier than what JS tests expect, so please either add
Puzzle
tag to kata or provide better explanation than:Your question is coming from assumption that your solution and depiction of the state of the board are are right, and that the test expected result is wrong. Well, you might be correct. But maybe not. For this to be investigated and reproduced, I think more information is needed for the "failing" test case like:
I've posted those logs in case I was missing something very obvious, but if that's not the case, then my question is can you provide me some more in depth explanation than
or if you can't, considering this to be a vital part of task, then I kindly request adding
Puzzle
tag (whenever that'll be possible) and I'll figure it out on my own.There is no trickery to that statement.
It means simply 4
X
or 4O
all in a straight line - e.g. such that a peice of string would go straight thru them all.Solutions could be (unless I've accidentally omitted some)
Symbols on same plane (x 4 planes)
...and solved, thanks for explanation.
For anyone still wondering...
It is the
O
in the 3rd row that are 4-in-a-row if you look at them like shown below (I made the other symbols as.
just for clarity)There is
using namespace std;
in C++ Preloaded section which should be removed. See: https://github.com/codewars/content-issues/wiki/List-of-Cpp-Kata-to-UpdateFixed
Python new test framework should be used with 3.8 enabled
Done.
can you tell me how X win in this situation?
with numpy i had a working solution in no time. then i spend one hour to make it fast enough haha awesome kata
Haskell translation
( This has
100
random tests. Was there any particular reason JS has1000
? )The Java original had 1000 tests.
Was there any particular reason NOT to have 1000?
Anyway, Approved.
My browser starts puking and eventually crashes. Also, the Haskell debug output isn't so bad, but when the JS framework ( dependent on version -
8.x
was worse ) shows1000
it
-headers, it takes forever to render.Hmmm... I dunno. If that's a drama then why not have those random 1000 tests within a single
it
. That would be more like the JUnit test anyway.It doesn't clarify 3 in a row is the win condition anywhere in the instructions. It should say that just to be clear. With the board being 4x4x4 people could write an entire 4 in a row solution then run the tests and have to do a bunch of work to fix it.
but the win condition is 4 marks... :o
This only reinforces my concern lol. Imgur was blocked on the internet I was one so I couldn't see the image so it should be clarified that it's 4 in a row. I did a lazy hard coded solution with lots of boolean checks rather than using increments and decrements on the x, y, and z coords and had to rewrite it :( At least I got better at using multicursor though
Kata description is updated
C# Translation added.Please review and approve~
Approved :-)
i am a newbie, i need dat print log on random test, can u please make it happen
You can make it happen yourself. Just print you own logs to see what is random input.
Use
System.out.println
,console.log
etc (whatever appropriate for your language)e.g. System.out.println(String.format("Input Moves %s", Arrays.deepToString(moves.toArray())));
@dinglemouse, JavaScript translation ready.
@dinglemouse, C++ translation ready.
Thanks
@ZED
for approvingI like it! thanks!
The sample test "xWins" looks invalid. Player O makes a move after the game is already over.
return moves.length%2 ? ...:...
would be enough!@pochman. It's deliberate. Kata description says
In the case you mention, you find the winner 1st before exhausting all the moves provided.
A "question"? What's the question?
I just find the description lacking and consider that an issue...
Well just to make it more obvious, I have updated the description.
Thanks, I think that makes it better (although typo "move moves" -> "more moves").
fixed typo. thanks.
python translation! ;)
Approved.
Hi,
It seems you forgot some directions in your solution... :wink:
Can confirm this issue. // Actually there are exactly two directions not begin computed.
Oh, you are right. I thought I'd covered everything.
Thanks for reporting. Let me take this offline and fix it tomorrow.
Try again. Hopefully fixed now.
it works like a charm... ;)
ADVERT
Please say it isn't true. Surely we don't need another Tic-Tac-Toe Kata!