Ad
  • Custom User Avatar

    There is apparently a namespace conflict in the Python testcases that doesn't allow you to import string. You will get an error like this:

    AttributeError: 'str' object has no attribute 'letters'

    This happens only in the random tests. It is because 'string' is used as a variable name, so it would be easy to fix.

    A workaround is either to solve it without importing string or to import it without using the string namespace - e.g. from string import letters.

  • Custom User Avatar

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

  • Custom User Avatar

    The mods are supposed to add translations in this case, but apparently there is no reliable way to contact them on this site. I marked this as an issue to try to get their attention but that obviously did not work. I suppose it will just happen at random whenever a mod happens by the comments here.

  • Custom User Avatar

    It is kind of hilarious that this is getting so many "Best Practices" votes and it doesn't even work! I guess people don't read the comments...

    It should be disqualified but there is an unfixed bug in Codewars that is preventing the Kata author from submitting a fixed Java test fixture.

  • Custom User Avatar

    Was going to do a Haskell translation but I noticed there are Python and Java translations sitting there that have not been added. I think I will wait until those are added, first.

  • Custom User Avatar

    The Java test cases are broken. It allowed my first solution (actually a buggy disaster) to pass, embarassingly.

    test10(SqInRectTest)
    test(SqInRectTest)
    Random test 0
    test1(SqInRectTest)
    test2(SqInRectTest)
    Test Passed
    test3(SqInRectTest)
    test4(SqInRectTest)
    test5(SqInRectTest)
    test6(SqInRectTest)
    test7(SqInRectTest)
    test8(SqInRectTest)
    test9(SqInRectTest)
    1 Passed
    0 Failed
    0 Errors
    
    Process took 3216ms to complete
    

    Note that only one of the 11 tests actually passed!

    For my new, correct solution, it does say that 11 tests have passed:

    test10(SqInRectTest)
    Test Passed
    test(SqInRectTest)
    Random test 0
    Random test 1
    Random test 2
    Random test 3
    Random test 4
    Random test 5
    Random test 6
    Random test 7
    Random test 8
    Random test 9
    Test Passed
    test1(SqInRectTest)
    Test Passed
    test2(SqInRectTest)
    Test Passed
    test3(SqInRectTest)
    Test Passed
    test4(SqInRectTest)
    Test Passed
    test5(SqInRectTest)
    Test Passed
    test6(SqInRectTest)
    Test Passed
    test7(SqInRectTest)
    Test Passed
    test8(SqInRectTest)
    Test Passed
    test9(SqInRectTest)
    Test Passed
    11 Passed
    0 Failed
    0 Errors
    
    Process took 3562ms to complete
    

    Someone more knowledgeable about Java needs to figure out what is wrong with the testing code.

  • Custom User Avatar

    Actually, it is worse than you thought. I actually don't know if this works at all! I think the Java tests for this Kata are actually broken.

    test10(SqInRectTest)
    test(SqInRectTest)
    Random test 0
    test1(SqInRectTest)
    test2(SqInRectTest)
    Test Passed
    test3(SqInRectTest)
    test4(SqInRectTest)
    test5(SqInRectTest)
    test6(SqInRectTest)
    test7(SqInRectTest)
    test8(SqInRectTest)
    test9(SqInRectTest)
    1 Passed
    0 Failed
    0 Errors
    
    Process took 3216ms to complete
    

    Notice anything? It only says "1 passed" and doesn't mention the other 10 tests!

    So it looks like the buggy test code allowed my buggy code to pass. How embarassing. :) Thanks for catching this, btw. I will have to debug my solution and the test code.

  • Custom User Avatar

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

  • Custom User Avatar

    I found this part of the description to be misleadingly ambiguous:

    How many times will the mother see the ball falling and bouncing in front of the window

    It needs to be more clear that you are counting both falling and bouncing. The way I first understood it was that "falling and bouncing" was a single event.

    Change it to something more like:

    How many times will the mother see the ball either fall or bounce past the window?

    (The phrasing seems a bit awkward but at least it is clearer).

  • Custom User Avatar

    Well, it was only designed to pass the actual Kata tests. It could start with a rate >= 21 and it would work fine for your example. But having everything being a neat multiple is quite artificial anyway, so I don't see any need to make it more general or robust. I'll save that for whenever I try the "Morse Code for real" Kata (currently in beta).

  • Custom User Avatar

    This kata appears to be a duplicate of http://www.codewars.com/kata/sudoku-solution-validator

    I succesfully submitted my solution to that kata here with trivial changes.

  • Custom User Avatar

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

  • Custom User Avatar

    I actually wrote this several weeks ago, but it did not succeed and I could not figure out why, because my algorithm seemed perfectly solid. I moved on to other katas. I came back to it today and submitted it just to see what the error was. To my great surprise, it succeeded! Evidently, the test cases simply had something wrong with them before. Nice to feel vindicated.

  • Custom User Avatar

    I'm getting a similar error:

    Falsifiable (after 2 tests): 
    expected: Just 0
     but got: Nothing
    [()]
    Positive {getPositive = 1}
    -1
    

    It has to be broken because a negative page or item (depending which function is being called - I can't actually tell) has to be invalid, and therefore a Nothing.

  • Custom User Avatar

    I have submitted a Haskell translation. I used testcases that fit the description rather than imitating the Python testcases. Namely, they do not test sizes smaller than 5. I hope that is okay. If not, the description should be corrected.

    I enjoyed the Kata, btw!

  • Loading more items...