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.
Corey, this is not about you personally!
But I am amazed that
5
kata and86
honour is apparently enough to publish a kata now. I thought the bar was higher ( and it was not high enough already ). Can somebody ping an official? ( A real one, not one of these "solve 3000 kata and become a self-appointed moderator" like me. ) Did CW just go down the drain entirely?PHP tests use
json_encode
to test key order in mappings, which is extemely poorly designed and should not be expected to work.The returned structure should be redesigned to something like
[{name: 'a', score: 5.33}, {name: 'b', score: 5}, ...]
. Don't do things the utterly wrong way.( JS, possibly others )
Needs random tests.
I don't know PHP, so the following is ( mostly ) applicable only to JavaScript.
Rounding is not a good way to make floating point numbers comparable. Comparison should be done with an error margin ( this would apply to both tests and solutions ).
Objects are not the most natural way to encode ordered lists in JS. Arrays are much more common and have much better native support for various operations. ( Note that your example solution exclusively works with intermediate arrays, even if it sometimes encodes intermediate values as objects. ) This is unnecessarily and artificially making the kata more complicated than it needs to be. This is not a best practice in general ( and not a good way to increase the difficulty level of the kata, if that was your intention ); it's a simple matter of choosing an inappropriate datatype. JavaScript has limited support for key/value-pair ordering in objects. ( That is to be read as "at defined times, it has no such support; at other times, it has very inflexible support, namely insertion order only, and no reordering support". )
That should be an empty object,
{}
. It would be better to correctly specify this than to show it in the initial code. Language-specific text in the description is possible.JS only knows
Number
.What does that mean ?
Wait, does that actually mean the submit tests are the same as the example tests? You can't do that; you should also have random tests, and you don't want those in your example tests.
that argument is next referred to as
players
. That$
might work in PHP; in JS it's just part of the name and should be taken out.that should say "object", not "array". ( I'm starting to think PHP doesn't differentiate between arrays and objects? Well, JS does! )
Key ordering is not part of dictionary equality in almost all languages, which basically means this requirement is not used at all, and hence makes no sense.
Why is JS returning an object instead of an array?
Description for JS:
=>
should be:
.Also,
JS does not use
{}
for arrays.Who wrote the initial code for JS version? Argument name should be
players
, not$players
.Also,
!players
do not make sense in JS because objects is always truthy. The first line in the function body is superfluous.