Ad
  • Custom User Avatar

    Hi, thanks for the continued checking of the kata :)

    I don't remember fixing this, but it's fixed now, another thank you if you did it yourself.

  • Custom User Avatar

    The case I was surprised there was no test for was 1 + x + 2 should simplify to x + 3, but I definitely had fun regardless

  • Custom User Avatar

    (for the record, this discussion had a follow up on Discord)

  • Custom User Avatar

    I see thanks, I had no idea that discord existed!

    That was 24hrs of 4-8hrs over several days while I have a full-time job. I would have happily continued with this kata without workarounds if I knew, and if the tests accounted for some of these kinds of cheats (which many katas do) that would have been an easy way to realize it was indeed a cheat and not an intended solution. The moment I saw that the other answers weren't cheats I started writing the comment, which if you can't see, is also marked a "suggestion" to add a one-line test that I would be surprised would be left out if not intentionally. But it happens. The clues I refer to are some of the other comments in the discourse, that talk about "rewriting from scratch" and using different approaches. I originally considered those to mean using a different mathematical approach, but over time I started wondering. Would have been fixed by a one-line test.

    And yes I was slightly surprised that a 1 kyu kata might be solved with a workaround, but maybe that was exactly the point of why it was hard. Knowing that you can do the workaround is not to be expected, and getting there requires some relatively creative thinking. The test that would invalidate it would simply be helpful for people approaching the task normally. I haven't solved a lot of 1kyu katas, but for other kyus it's pretty common to have that kind of test or something that would invalidate the workaround. Maybe figuring out that wasn't being tested for was the challenge, I had no way of knowing. Also note this kata is marked as the easiest 1kyu. And for those that can't see the original comment: the workaround is not messing with any test functions or codewars/test internals, it's standalone javascript: I was returning an array of 4 elements that when squared and summed led to the answer, it was just enough in the spirit of the challenge that I figured that might be it. A similar argument can be made that a 1kyu kata might need to be better tested than higher kyu katas, but I don't know if that's really the case.

    I admit I did not see the tags at all, when you pointed those out I did feel pretty dumb. For sure in the future I'll double check on the discord or post a comment on the discourse before submitting an answer that I'm not 100% sure is in the spirit of the challenge. I already felt like I was cheating a little bit by looking at guidance on the discourse, let alone get help on a discord, but good to know that's better than experimenting yourself to see if you can solve the challenge, given your solution might not be in the spirit of it. I don't think I should have been penalized, or at least I should now have been able to submit another solution and get my score back, and my request for a one-line test shouldn't have been dismissed, and the fact that I immediately pointed it out in the discourse with a lengthy and respectful comment should have been rewarded rather than penalized.

    I'm clearly still a bit upset over losing several days of free time in the context of codewars score, but that's life, I'll move on. I'll look for the discord now, see you there :)

  • Custom User Avatar

    You could have asked a question on the dashboard regarding performance requirements and legit strategies to solving this problem. Also, those other kata's that DO require us to exploit language features are 6-5 kyu. Did you really think a 1 kyu kata has an expected solution with a simple one line exploit as you pulled off?

    I was only able to pass half of the 1024 bit tests in time. I was pretty tired and frustrated, I figured it's unlikely I missed some big optimization with the current approach, and figured the solution needs to be entirely different.

  • Custom User Avatar

    Example tests:

        assert(reduce([5, 3, 6, 1], (a, b, i) => a + b * i), 23, 'hint: ')
    

    That failure message doesn't hint very much.

  • Custom User Avatar

    [].push.call isn't push, it's call, without a context. Function.prototype.call.bind(Array.prototype.push) might work; I haven't actually checked.

  • Custom User Avatar

    (preemptive disclaimer: I cannot see the two top comments because they are hidden as spoilers)

    Ad "Some katas are literally about finding ways to break expectations of the language, I had no way of knowing this wasn't one of them, instead had false clues pointing to the fact that it might be." : kata which are literally about breaking expectations of the language are not tagged as mathematics and performance. I am not sure what could be the clues pointing in this direction, but whatever they are, they should be removed or made look less clue-like.

    I admit that the line between "breaking expectations of the language" and "unacceptable cheating" can be sometimes blurry, but usually is drawn at the point where solution attempts to directly affect tests: override functions of the testing framework, fool assertions, prevent or impact execution of tests. I am not exactly sure how "find four numbers" would call for such means, but maybe I am missing something :)

    The honor/score associated with the kata has been lost because this is how system works when a solution is flagged as a cheat solution. When a moderator marks a solution as a "universal cheat", the solution is hidden (to not spread), and the reward is withdrawn with a small penalty.

    Ad "most solutions are just a copy of someone else's code, some verbatim (but that's not considered cheating?)" : plagiarism is considered unfair, and is also handled. Copied solutions are usually handled in a similar way as universal cheats, except of hiding: users who submitted them have their reward retracted. Regular users have no way of knowing if a solution they see has been penalized or not, but I in case of this specific kata, I would be surprised if they were not. You can also report dishonest users on #contact-mods channel of Codewars Discord.

    Additionally, keep in mind that when stuck, you can always ask for help in the #help-solve channel of Codewars Discord. Users there are always willing to help, and I am pretty sure that many users who solved this kata struggled with it for much, much longer than a day :)

  • Custom User Avatar

    I see that's definitely the case for this kata, that's why as soon as I noticed I made this comment.

    Some katas are literally about finding ways to break expectations of the language, I had no way of knowing this wasn't one of them, instead had false clues pointing to the fact that it might be.

    I would have retracted my solution if I knew how. Now I've tried to submit another one, which is not just a plain copy of someone else's solution, although most solutions are just a copy of someone else's code, some verbatim (but that's not considered cheating?), but after I submit I'm still told solutions have been withheld, and I lost the score/honor associated with the kata :/

    It's not the end of the world, but it feels like this wasn't my fault and I wasn't given a way to correct it, just penalized, after I spent over 24hrs working on this challenge with more good faith than the other solutions I've seen.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    I added some index-predicated tests for all applicable methods now, although of course there's still just not a lot of tests in general. I mentioned the lack of index-predicated tests in the first discourse comment.

    You're right on fill, also push. I modified the kata description.

    I think all tests here are === as it should be (?), but maybe you're referring to python's === vs ==, in which case yes it looks like I'm checking itemwise by reference, which is what you would expect. But also yes, the tests are not currently making sure that e.g. map is not modifying the original array. Although that would affect the arr20 variable which would make subsequent tests fail. Theoretically it could be undetected for the last reduce test, but I think it's fine for a 5kyu.

    It might make sense to have a 4kyu kata about implementing all array methods exactly (including sort and negative slicing and thisArg), with all the fun behaviours. This is more of a "do you know which array method corresponds to which intention" test. In the description I do mention we're looking at common usages rather than exact replicas. Let me know if you think that should be made more obvious, or how to handle it

  • Custom User Avatar

    I wasn't aware of this reduce behaviour, fascinating! Fixed

  • Custom User Avatar

    Took care of enumerability. And good catch on the format bug, I must have been really tired :)

    Also checked that const push = [].push.call won't work, and I'm not 100% sure why. I wonder if there's other workarounds the user has, given that when user code first runs, array methods are accessible (just not when the functions are being called)

  • Loading more items...