Ad
  • Custom User Avatar

    Approved.

  • Custom User Avatar

    You're mutating the input list. That was the reason why it failed. I've approved the fork below so tampering with it won't be a problem anymore.

  • Custom User Avatar

    Manually checked the log, solution is correct.

    Random tests always fail with:

      File "/workspace/default/.venv/lib/python3.10/site-packages/codewars_test/test_framework.py", line 112, in wrapper
        func()
      File "/workspace/default/tests.py", line 32, in random_test_case
        test.assert_equals(cup_and_balls(b2,qwe2), cup_and_ballsFed(b1, qwe1))
      File "/workspace/default/tests.py", line 7, in cup_and_ballsFed
        if b == i[1]: b = i[0]
    IndexError: list index out of range```
    
  • Custom User Avatar

    Python translation forked to prevent the user from tampering with the test data. See here

  • Custom User Avatar

    that was fun. thanks for kata

  • Custom User Avatar

    Are you sure of this? if (arr.length === 1) return arr[0][0];
    b is constant in your code, you should be using the current ball position in your loop.

  • Custom User Avatar

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

  • Custom User Avatar

    I had not even noticed there could be more than three cups in the other one. I sincerely doubt that makes it more difficult - my solution here and there are exactly the same. Change function name, Submit. That exactly.

    There is nothing to be done now. If you had known, you should not have published in the first place, but we're past that and it got approved already ( maybe too soon ).

    Don't sweat it, electrons aren't that expensive. Take good care of your kata and try not to publish duplicates in future ( which may be difficult because names are unreliable. FYI, base -2 arithmetic is done in "SKRZAT" :P ).

  • Custom User Avatar

    Done :)

  • Custom User Avatar

    Thanks for raising this, it completely wasn't my intention! With regards to them being 'exactly' the same the original is more difficult as they don't limit the amount of cups/shells to three. But you're right, is there something I should do ?

  • Custom User Avatar

    Yep. Exactly the same. Four years ago.

    Oh well, it's been approved already.

  • Custom User Avatar

    Ruby and Python translations, please check and approve :-)

  • Custom User Avatar
  • Custom User Avatar

    Ok perfect, thankyou :)

  • Custom User Avatar

    I followed

    • There will only ever be three cups.
    • Only two cups will be swapped at a time.
    • The cups and their switches will be refered to by their index in a row of three, beginning at one. So [[1,2]] means the cup at position one, is swapped with the cup at position two.
    • Arr will be an array of integers 1 - 3 organised in pairs.
    • There won't be any empty sub-arrays.
    • If arr is just an empty array b should be returned.

    for both translations :-)

  • Loading more items...