6 kyu
Tic-Tac-Toe-like table Generator
1,531 of 2,260GiacomoSorbi
Loading description...
ASCII Art
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.
I hope I'm not overthinking, but I don't understand how we will know the correct number of rows. Are all of the inputs going to be nx2 rectangles? If so, I feel like that should be stated. Instead, all that is stated is that the "length of the array will always be a multiple of the width." But what if we are given an array of length 12? Will that be a 6x2, 2x6, 4x3, or 3x4 board? It says we are expanding beyond 3x3 squares and "accepting" rectangles of "big sizes." But without knowing the dimensions, there could be ambiguous solutions. Even with the example of a 5x2 board, what's to say it couldn't have been a 2x10 board instead? All of the conditions will still have been met.
width
of the board is given to you as a parameter. If you know how many cells is there and you know the width of the board, figuring out the amount of rows should be trivial?Welp, I guess that's about as braindead as you can get. I hadn't even entered into the kata because I couldn't figure out the description, so I didn't even see the parameters. Serves me right, haha. Thanks!
js fork enabling node 18 powered by katafix 🤖
mocha/chai
lodash
Merged.
This comment has been hidden.
You should return the final solution instead of printing it.
Troubleshooting Your Solution - Print vs Return
Resolved - not a kata issue
That was really hard for me... But i made it!
Node 12 should be enabled (Refer this and this for more info)
Python new test framework should be used (Refer this & this for more detail)
Ruby 3.0 should be enabled (Refer this & this for more detail)
Done for Python.
Done for Ruby, in this fork.
Done for JS.
C++ 17 should be enabled.
This comment has been hidden.
someone may be able to help you, but don't forget to mark code with the spoiler tag. it's forbidden without the tag because otherwise everyone can see it, which is not OK, even if it doesn't work.
ouuuh, sorry
This comment has been hidden.
C# Translation added.Please review and approve~
This looks like another good translation.
My feedback is primarily just preference stuff, so feel free to implement/ignore anything:
RandomTests
and instead put it as the message on the tests. This will mean it only appears when the test fails. It also has the advantage that the log line will show for failed Basic Tests. It could be like this:Assert.AreEqual(expected, Kata.DisplayBoard(board, width), $"Testing with input {FormatArray(board)} and width {width}.");
All done.Hope you will be happy of it.
It's perfect, thank you for implementing those items.
Thank you Steffan for approving.
I didn't approve it, the original author (Giacomo) approved it...
I loved this kata. It's a really clever way of making sure you understand the fundamentals. I first figured out the logic needed to get the results using print on an IDE and then realized I needed actually return an output since this was a function. Luckily strings are easy to manipulate with a simple += so I didn't have to change the structure of the code.
Glad you appreciate; doing concatenation is not necessarily the most performing way to achieve what you need to achieve, but it can work pretty fine :)
I'm still learning the basics of python (and programming in general). After comparing the solutions I have for various katas to the "best" and "clever" solutions others have devised, I have no doubt that most of the code I've written is subpar. If you don't mind me asking, what would be a more performant way of approaching this problem?
Precompute the length of the final string, generate it, then go and replace the chunks as needed. a
"".join()
is still somehow better, but if you keep increasing a string at each step, you will do a lot of reallocation every few steps.C translation ready.
Java translation ready.
Thanks mate :)
Ruby
Ops, keep forgetting that I should use
...
, not..
in ranges; fixed, thanks :+1: