Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Let's go to Mars! ^^
That wasn't present. I added a subsection about the family at the beginning of the rules where I put that information.
Thanks for beta testing it again! (Almost a week.)
I don't think so. I usually pass the tests between 4 to 6 seconds. Sometimes, rarely, it takes 8 or 9 seconds. If you think that the tests are too unbalanced, I can shrink some of them.
I was, exactly five seconds ago, going to add a note about that. The direction of a path is not important. The path
1 → 2 → 3
is the same than the path3 → 2 → 1
. That's why I chose to show paths in different directions in the sample tests.No, but each path can have a different common ancestor. I see your point, I will think of way to make it clearer.
Edit: I changed the formula to
Where
$c_p$
is the common ancestor of a and b on the path p.I accommodated the tests to the new definition: there's now one path between someone and themself.
in this kata: a person has either both a mother and a father, or neither a father nor a mother
I changed the first sentence of the rules to
An ancestor of a person is either themself or any direct ascendant of that person
. I also removed the sentence about the common ancestor when going down from an ancestor to some of their descendant.When I was doing my research, I found that there are other things to take account of when computing the coancestry of two persons for some specific cases (for example when they are ancestor-descendant in one way and cousins in another way). The note is there to inform the user that the formula is not exact for some cases. Maybe I should rephrase it.
Approved, thanks for your work and your support.
Two errors in the sample and fixed tests that I edited:
That sounds good.
I adapted the code and added these two points after the definition of the expected structure in the
Task
subsection:Then, in the Python code block:
In Python, you can define a custom structure. The default one is the following dataclass Person:
.If that's not easily doable in some language, the translator will just have to add, in the code block of its language, "You can't define your own structure in X. You are provided with the following one....".
I thought about asking to render a string when I was designing the kata and I thought that users like Voile wouldn't like an artificial step not related to the core task. Let's keep your first idea: defining a minimal contract and providing a default implementation. I will do that for Python later today, or tomorrow (I'm working on the cousin marriage kata right now).
I can do that later. There's a
__str__
method tied to the Person class that is used by the tests to display the actual tree if any error occurs. I wanted it to be available for the user so that they can have a somewhat (only the subtree rooted at the node on which the method is called) useful representation of what they are doing.I plan to translate this kata to my other usual languages some day (not now). It will be easy to do it in JS, but how would you see it in Java or Common Lisp, for instance ?
Loading more items...