Ad
  • Custom User Avatar

    I solved it without them, but I really wish I didn't...

  • Custom User Avatar

    Unfortunately the philosophy of the people running the show at codewars is hostile to that sentiment. They are not focused on providing educational or useful katas, and do not attempt to filter based on that criteria at all. The best you can do is skip the bad katas that are focused on massaging the ego of the kata's author when you recognize them (saying this random coding unrelated geometry trivia is "elementary" for example), or just unlock solutions and move on if you don't see anything useful. In all honesty, take a look at some kata authors and you'll notice a pattern... you might want to skip katas from them entirely.

  • Custom User Avatar

    This gets around the tests by checking for spaces in the city name, but the description does say to exclude any non-alphabetical characters as well which this would not pass were that tested.

  • Custom User Avatar

    Good use of short-circuit evaluation, helped me clean my code up.

  • Custom User Avatar

    The brackets [] are a way of accessing an object's property called bracket notation.
    The more common way like ops.propertyName is called dot notation.

    I use bracket notation here because it allows you to use variables, and dot notation does not.

    ops[operation] returns the property value matching operation if it exists, and undefined otherwise. The property value for + - * / are all function references.

    ops[operation]() returns that function reference from the [] and then knows to actually execute the function because of the (). It's just like calling a method with dot notation. If you accidentally type Object.method instead of Object.method(), you get a function reference instead of executing the function.

    In my solutions it's not an IIFE because the function was defined inside of the object, then invoked later rather than immediately.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You can't solve a puzzle without the pieces. Providing relevant information to solve a kata is not spoonfeeding people, it's giving them the necessary pieces to solve the puzzle. By gatekeeping the puzzle pieces behind arbitrary knowledge/trivia checks, you aren't challenging people to be creative and thoughtful... you're just making them waste their time googling irrelevant trivia that could have been included in the description. You either know the trivia or you don't.

    If you read the other discussions on this kata (and similar ones), you'll see multiple upvoted comments expressing frustration with both the content and description. Geometry trivia masquerading as coding challenges is not popular , especially when the relevant trivia is not explained within the description.

    Most authors understand this intuitively and provide relevant information on their own. For those that don't, what's the harm in improving the description based on feedback?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Some katas should really be retired, and this is one of them. The unresolved issues marked "Resolved" from years ago remain, unsurprisingly, unresolved. This is what drives people away from codewars.

    This kata is not a coding challenge. This kata is a linear algebra challenge.

    The coding aspects of this problem: return a value from a simple math expression (mx +b) where m and b are known, rounded to two decimal places. A challenging but within reason ask for beginners (which this is marked as, being 8kyu)... IF m and b are given.

    However, this kata doesn't give you m and b. This kata requires you to learn linear algebra to find m and b. Finding m and b is the real challenge here. Finding m and b has absolutely nothing to do with coding. Therefore, this kata is completely inappropriate for the spirit of a website supposedly centered around providing coding challenges, but especially inappropriate for an 8kyu.

    Having math as part of coding challenges is reasonable. Having math as THE challenge, with a tiny sprinkle of code on the side, makes no sense. At that point it's no longer a coding challenge.

    A true beginner coming across this kata is more likely to leave the site and never come back than to solve it. And when they do solve it, did they learn anything about coding? No. They learned linear algebra.

  • Custom User Avatar

    I know that similar suggestions to clarify the descriptions have been made and marked resolved, but the ambiguous description remains as the biggest obstacle to solving this kata.

    TL;DR: Two suggestions: One is to pass the alias objects into the function as params by default, so they're very visible. The other (if the first is not possible) is to very clearly and unambiguously state how to reference the alias objects from inside of your function.


    I solved this kata just now, but I needed to spend a very dispoportionate amount of time trying to understand what was going on in the description and function itself. Once I understand what was being asked of me (and given to me) the challenge itself was good for an 8kyu, but the hard-to-understand context made it very difficult to reach that point.

    If it's possible to do this I'd suggest altering the function to have default parameters, and passing the pre-defined objects in as arguments to the function. This would make it more clear that they're there and available to be referenced. As it is, it appears like those objects magically exist from an invisible global state when you reference them during execution.

    If it's not possible to change the function, including a very specific statement on how to reference the objects in the description would be the next best option.

    Changing this line "Two objects that return a one word name in response to the first letter of the first name and one for the first letter of the surname are already given."

    To "Two objects that return a one word name in response to the first letter of the first name and one for the first letter of the surname are already given. You can reference them inside of your function as firstName and surname."

  • Custom User Avatar

    Agree with the above, though this issue was marked resolved the ambiguous description is still a problem imo.

  • Custom User Avatar

    Is it possible to edit the description to say "rounded to up to two decimal places." rather than "rounded to two decimal places." in that case? It would have been a very helpful distinction for me, and possibly for many others in the future.

  • Loading more items...