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.
You cannot, that's true. But this is a dojo here... and the kata should give you an insight.
btw: In Karate you won't defend yourself running a kata (e.g. Empi or Unsu) when you gonna beaten up by some rude guys.
Well, it does not need more, but better test cases, like using special char words... as described in instructions. The random test case generator is a nice thing, but not very productive and not comprehensive. WOuld be much better to test exactly what's written in the instructions. Nevertheless, nice kata!
Improve the problems description, please. It should be possible to understand the problem without reading the testcase first. User 'kristaps' already proposed a suggestion.
Quite nice. I like performant solutions. And this one is a good example where one can find advantages and drawbacks. Usually, it is like this: Performant solutions lack readability and are more difficult to understand. Less performant solutions have other advantages, like they are more comprehensive for others, or they are better encapsuled in their context, are reusable, are testable, etc. etc. Of course, the latters no count for this specific algorithmic problem. But your solution reveals something interesting, which I knew from earlier experiments: pure for-loops are much faster, than forEach, filter and other iterator functions. The iterator functions abstract the underlying structures which comes of the cost of some additional overhead, but those solutions are easy to use and understand. In other languages (p.e. Java, C++, C#) those abstractions are used for generic data structures which comes very handy - and it is elegant!
Thanks for feedback. I considered your suggestion and applied it. There's no special reason why I chose 'expect'. IMHO the code sounds slightly more natural with test.expects() than with test.assertEquals().
Yes.
Great!
Fixed. It says "Assert: a1=1" instead of "Assert: a1===1".
What about .234.56.73 and -123.45.67.89?
I know your solution passes, but only because the test specification is lacky. Hence, not your fault ;)
I suggest to test also IPs like
-123.34.56.-2
.4.4.6
232..34.2
Whitespace should not invalidate an IP address in my opinion.
@svol Conforming RFC3330 0.0.0.0/8 are valid IPs.
Thx
Thx and full Ack. The core question is: What defines a good solution?
This can be a polemic discussion...but hopefully not like Android vs iOS or Amiga vs Atari :D
Well, obviously my intention was misunderstood. Since I started to train here I learned a lot. I don't post the perf comparisons to make others worse. I am far away from being a good coder and I am always impressed by the solutions provided here.
I also think sometimes a communities favorite solution has one or more drawbacks which may not be obvious. And posting JsPerfs can reveal some hints about it. These kinds of 'drawbacks' can be measured and presented in an objective manner. Inspecting solutions and comparing them considering different aspects is a very good way to learn (at least for me).
Like "Uncle Bob" I train some katas several times to see if I can find another probably better solution. This is the real deal of a kata...try to perfect it by inumerous repetition.
Sorry, If you felt (or others) offended. This was not my intention.
The idea of the kata is nice. But the description is misleading or at least the tests are too easy to pass. An FSM is quite easy to implement, if it would be only about state transitions. As a class-like definition was provided I expected a more sophisticated OO-like solution. Most people won't follow the concept of a more generic automaton.
As it can be solved easily I tend to suggest a --rank !
Ooops, am I repeating @nooga? ;)
Opa.... vlw pelo upvote! Did you see my tuned version already...?
Loading more items...