Ad
  • Custom User Avatar
  • Custom User Avatar

    done

  • Custom User Avatar

    You're right I should clarify that if the current player's whole row is empty, then it should only skip his turn but the move is not skipped. (of course if both players whole row is empty, then end the game)

    Also, if the current player's move points to an empty hole, but its whole row is not empty, then it will skip that move but not the players turn.

    I'll update the description and reference solution, thank you

  • Custom User Avatar

    The random tests in Python have several issues:

    • Lower bound of rows/columns of 2 instead of 10 per the description.
    • Reference solution throws an error if no elements of the contour are within the range $[a,b]$, which is not a guaranteed property of the generated matrices.
  • Custom User Avatar

    Following that rule, all remaining moves would be skipped if the player's row was empty, because there are no valid moves.

  • Custom User Avatar

    Maybe so, or maybe the description is not very clear about this part. From the example, I read this rule that a move should be ignored in such case, but the player stays the same.

    The 4th hole in player 2's row is empty, so what you will do is skip that move, but it's still player 2's turn, until it gets to a valid move.

  • Custom User Avatar

    In sungka, when you're out of marbles in your row, you will keep on skipping turns until a marble reaches in one of your holes in your row.

    The reference solution in Python does not follow this rule, which can lead to unexpected failures in the random tests for solutions that do follow the rule.

    Here's one such input:

    moves:
      [4, 5, 7, 3, 2, 1, 7, 6, 2, 3, 3, 1, 6, 1, 3, 7, 3, 4, 7, 6, 6, 5, 7, 7, 5, 4, 7, 3, 7, 7, 1, 2, 6, 7, 2, 6, 6, 6, 4, 4, 4, 2, 7, 1, 2, 2, 4, 3, 6, 2, 2, 3, 2, 1, 1, 4, 5, 6, 4, 1, 1, 5, 4, 4, 7, 1, 5, 3, 5, 2, 2, 1, 4, 2, 2, 4, 6, 5, 1, 5, 1, 6, 6, 2, 3, 7, 3, 7, 3, 4, 7, 4, 2, 2, 4, 1]
    reference solution:
      [[0, 0, 0, 0, 0, 0, 0, 60], [0, 0, 2, 2, 1, 1, 3, 29], 1]
    actual solution:
      [[0, 0, 0, 0, 0, 0, 0, 63], [0, 0, 0, 0, 1, 2, 0, 32], 1]
    
  • Custom User Avatar

    Political correctness really is taking over, we have to inject pronouns into our Codewars katas xD

  • Custom User Avatar

    It seems that the performance version has looser performance requirements than I expected, because my refsol only performs a single optimization to trim the search space for common subsequences instead of the full DP implementation.

    I've forked my fork, reverting the reference solution.

  • Custom User Avatar

    Remember to not make the refsol a spoiler for the performance version.

  • Custom User Avatar

    I've made a fork that addresses all of these along with updating the reference solution to be much more efficient.

  • Custom User Avatar

    Random tests in Haskell could use some work:

    • Almost every pair of random strings contains a longest common subsequence of length 0 or 1, which allows for solutions like this.
    • The error messages for random inputs aren't very helpful:
      • The random strings use characters from the entire range of Char, leading to pairs of strings like "G8\1100651\95058\SUB\\A\b" and "\n\n"
      • When the returned value is shorter than the expected value, the error message will be something like expected: 0 but got: 3, with no indication of what the numbers indicate.
      • When the returned value is not a common subsequence, the error message is expected: True but got: False, which again does not tell the solver what the actual problem is.
  • Custom User Avatar

    the OP made an additional fork with making the description lang-agnostic, approved now

  • Custom User Avatar
  • Custom User Avatar

    Not a bad idea! Forked with the suggested description changes.

  • Loading more items...