Ad
  • Custom User Avatar

    Any updates on this issue?

  • Custom User Avatar

    afaik you can't edit test cases if 500+ warriors passed them.

  • Custom User Avatar

    Once the kata has been completed 500+ times it can no longer be edited except by admins - in order to prevent the kata from breaking everyone's solutions after it became popular. What were you looking to change?

  • Default User Avatar

    It's probably bug in codewars (or in some specific library version). You should report it.

    Could you please change the assertion to this form, so we can submit our solutions:

    assertThat(CaffeineBuzz.caffeineBuzz(12), is("CoffeScript"));
    

    Thanks

  • Default User Avatar

    Well the root cause is extra 'e' in your assertion. When I run it outside codewars I get:

    org.junit.ComparisonFailure: 
    Expected :CoffeeScript
    Actual   :CoffeScript
    

    But I don't know, why it doesn't show the correct output here.

    FYI: if you use assertThat notation, it works OK ;)

    assertThat(CaffeineBuzz.caffeineBuzz(12), is("CoffeeScript")); //wrong test with extra 'e'
    
  • Custom User Avatar

    Ahh... it's because I didn't set the random number generator to use non-negative numbers

  • Custom User Avatar

    I added randomized testing to your other kata as an example, btw.

    Haskell makes this much easier than other languages, IMHO, and it's a great practice for testing actualy production code.

  • Custom User Avatar

    BTW, as far as I can tell, you can generate credit card numbers by simply incrementing the final digit given an odd number of digits.

    It's okay, btw, if you don't know QuickCheck. It's something you only start to learn after doing Haskell for a while. But you can see my other kata where I use it.

  • Custom User Avatar

    http://www.getcreditcardnumbers.com/

    Anyway, I added randomized testing... so your hacky solution probably shouldn't work.

    QuickCheck supports rejection sampling, so for small input it should be possible to use a reference solution to force valid input/invalid input, but for now I just check that the users input matches the reference solution for a wide input range.

  • Custom User Avatar

    Hmm... fair enough.

    I see why you occluded a bunch of the tests now. I'll go update the kata framework.

    It's a bit of a pitty you didn't implement the actual Luhn algorithm, we could just generate valid/invalid CC numbers.

  • Default User Avatar

    just to mark resolved

  • Default User Avatar

    I wanted it to be like some additional kind of puzzle with this kata, but you are right, this can be confusing, starter fixed

  • Custom User Avatar

    Glad you liked it. :-)

    I'll be sure to update the solution.

    Thanks for the nice kata!

  • Custom User Avatar

    Errors like this are usually a case of incorrect type. Are you returning a string?

  • Custom User Avatar

    You are right that BFS will return the first path it finds, but by nature of BFS and the fact that there are no edge weights, that will be the shortest path.

    Although my math is not strong enough to outline a proof [ :-) ], I have pretty high confidence level that BFS will always work.

    BTW, I used BFS for my solution and it passed all your tests. I'd be interested in seeing a map where BFS does not work...

  • Loading more items...