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.
Thank you so much for the kata approval!!!
@JohanWiltink Thank you very much for the JS translation and adding progressive sizing there! Just have added it!
Hi! I am sorry for the late reply! Yes, @KayleighWasTaken,please, feel absolutely free to rework the test generation and structure, if you would have time for it, I would be extremely grateful for your help!! You're also completely right that the generators are messy!
Thank you so much!! Added it!
Algorithmically they're not that bad? I more or less transliterated for the JS translation ( with progressive test sizing added ), and it's what ( and how ) I would have done myself.
That was my fault, fixed.
I could tell that's what you were going for but the actual generation functions are really messy and I didn't want to reimplement them in case there was some biasing you were doing intentionally that I might remove.
If you just want 50% case distribution I can implement it this evening (along with some nice progressive test sizing so that the top assertion messages are easier to read for the user).
Solutions that depend on the hidden number being non-zero pass. Consider if you want this. If you do, the description should probably specify the number will be positive. If you don't, there should probably be a test with a hidden
0
. ( Negative numbers are also a possibility, but are less likely to trip up solutions. )JS translation
This comment is hidden because it contains spoiler information about the solution
( Python )
Failure test message is constructed from argument that solver has had their dirty hands on. Don't just calculate expected value first, pass solver a ( deep ) copy of the input ( and, just in case the reference solution inadvertently modifies its argument, it too ).
( I'd fix it, but I don't know how to make a reliable deep copy in Python. )
Thank you KayleightWasTaken! You we pointing me about this issue of test cases in a different kata but I forgot to change it here :/ . I will go around my other katas shortly and modify it and make sure not to do this mistake again!
So what happens with the functions that generate structures. I have one for generating bad structures
generate_bad_structure
which should ideally test forFalse
cases andgenerate_nested
which generateTrue
case structures and 50% chance to select one of them.generate_bad_structure
generates random nested arrays and usually they are False structures but I also noticed that ocasionally it does create some true structures ( usually, when the structure is small like [ [],[],[] ]). I think, they should be fine but, if not, please let me know.Hi! Yes, you are definitely right about antipattern. Just have approved the proposed translation by KayleighWasTaken which tackles the problem
Somewhat refactored the tests here. Didn't touch the test generation code itself though, not currently awake enough to try to parse what exactly it's trying to achieve, though
generate_bad_structure
seems to generateTrue
cases sometimes, and the inverse forgenerate_nested
?I'll have a go at cleaning up the tests a little and adding assertion messages etc then.
Loading more items...