Ad
  • Custom User Avatar

    Obviously if a power user does it, they probably did it for a reason :)

  • Custom User Avatar

    Before anybody starts reporting me:

    if and when I cheat, I do it for a higher purpose!

    That's my story and I'm sticking to it. :innocent:

  • Custom User Avatar

    Fail his tests.

    Pray for his soul.

    Move on.

    If you didn't catch him, improve your tests where reasonable; where unreasonable, see above ( from (2) ).

  • Custom User Avatar

    You report it on github. And if they do it several times, they'll ban the user.

  • Default User Avatar

    What is the right thing to do when you catch an an indefensibly blatant cheater?

  • Custom User Avatar

    I will try to check that the function don't use the for or while loop, maybe in a test

    The correct way to test that has been invented already.

    This is the incorrect way. Cheaters gonna cheat, and up to a point, you'll have to catch 'em at it.

  • Custom User Avatar

    That's probably going to be too late for this kata; I expect retirement any minute now.

    When publishing a kata, you have to get most everything mostly right right from the start, or its ratings will never recover.

    The bar for publishing kata is high, much higher than for solving kata. Not everybody agrees with that, and a sandbox for trying out creating kata is sorely missing, but in my unhumble opinion, CW is primarily for solving kata, not for creating kata. Kata have to be created to be solved of course, but if there's one thing CW doesn't need it's more low quality kata ( it could also do with a little more civility, but that's a different discussion ). So not everybody needs to be creating kata. The ability to create kata is, again IMUO, given too soon to people. We see a lot of kata from people that are not ready for it. That includes you, ATM.

    If and when you publish a new version of this kata, even with appropriate and solid testing for a refactoring kata ( which is decidedly not easy ), it may very well start acquiring issues to the tune of "this has been done". There already are kata that ask to map, filter and reduce an array without the use of for and while, and they're basically all the same. Please refer to the Wiki, Kata Best Practices, "Make Sure Content is New". I don't have example duplicate kata handy, but if you take the advice of Wiki, Creating your first kata, "Solve more katas" and "Solve more katas (again)", you will come across several yourself. Just in JavaScript, there are 6000 kata, so it may take solving more than 30 of 'em to develop a feel for what has been done to death and what might be new ( and yes, with 6000 existing kata, a lot has been done already ).

    The best advice I can give you at this moment is solve more kata, and postpone creating new ones to a moment when you have seen more of how other people do it ( and what works and what doesn't ).

  • Custom User Avatar

    I will try to check that the function don't use the for or while loop, maybe in a test
    Thanks!

  • Custom User Avatar

    It may be better to use the term "functional" then.

  • Custom User Avatar

    Fixed. But this kata is beyond salvation: the author clearly doesn't understand what he's talking about ("declarative programming in JavaScript"), the "requirements" are not enforced, and the fact that the author openly says that the user can pass the tests by simply submitting the initial solution is outrageous. This is the definition of trash.

  • Custom User Avatar

    I want to refer to declarative programming
    One of the attributes of functional programming. (Using map, reduce, filter, etc instead of for loops)

  • Custom User Avatar

    I still have no idea what you mean by "declarative".

    "Anything that's not imperative" is a bit vague.

  • Custom User Avatar

    The recommended way to write tests is to use chai. You can also use the built-in CW test framework, but chai is the most recommended. You can also use mocha. But not saying that should won't work.
    See https://github.com/Codewars/codewars.com/wiki/Language-JavaScript

    It should let you edit sample tests, does it give you some error?

  • Custom User Avatar

    I just realized it trying to do it.
    The sample test is not including the:
    const should = require('should');
    If you run the complete test it runs the test ok.
    I'm trying to add in the sample test the required library but I don't allow me to do it

  • Custom User Avatar

    I had a feeling this was your first kata already.

    Did you read available documentation?

    You set the bar high for yourself. A simple algorithmic kata might have been easier as a first one; the testing for kata like these is going to be interesting. It's hard to do right! Read tests from existing kata ( you can see the tests after you've solved them ) and learn. :] For algorithmic kata, random testing is practically a must; for a refactoring kata, there simply is no established standard for testing ( if only because there are few to none refactoring kata ). Ask yourself what you want to see in a valid solution and actively, actually test for that. Then ask yourself what would make a solution invalid, and test against that.

    Good luck!

  • Loading more items...