Ad
  • Custom User Avatar
  • Custom User Avatar

    hardly elegant to use isalnum, more hamfisted and lazy in context of the kata

  • Custom User Avatar

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

  • Custom User Avatar

    That's strange. When I print out the second test for the "Pawns increasing and decreasing" case I get this:

    Board:

    . . . . . . . .
    . . . . . . . .
    . . . 4 5 . . .
    . . 3 . . 6 . .
    . 2 . . R . 7 .
    1 . . . . . . 8
    . . . . . . . .
    . . . . . . . .

    There is no pawn 9. The pawns are exactly the same for all three "Pawns increasing and decreasing" tests. Only the rook position changes.

    Is it possible that your code is modifying the pawns between the three tests? Otherwise I don't know what could be the issue.

  • Custom User Avatar

    Thqnks for the reply,

    these were the boards printed by the test cases that failed, I'm not printing them myself (code only prints out a cost matrix).

  • Custom User Avatar

    Hi djkat,

    I think you have the wrong board. The board for all three positions called "Pawns increasing and decreasing" only has 8 pawns.

    Regards,
    brodiemark

  • Custom User Avatar

    A few of the test cases seem wrong:
    "Pawns increasing and decreasing; 3 different rook-positions"

    "Board:

    . . . 1 . . . .

    . . . . . . . .

    . . . 5 6 . . .

    . . 4 . . 7 . .

    . 3 . . R . 8 .

    2 . . . . . . 9

    . . . . . . . .

    . . . . . . . .

    Min path is 7->8->6->5->4->3->2->1: 21 should equal 17"

    -- but doesnt the path have to include 9?
    Similarly:

    "Board:

    . . . 2 . . . .

    . . . . . . . .

    . . . 6 7 . . .

    . . 5 . . 8 . .

    . 4 . . 1 . 9 .

    3 . . . . . . 10

    . . . . . . . .

    R . . . . . . .

    Min path is 1->2->3->4->5->6->7->8: 21 should equal 15"

    -- Path does not include 9 or 10, and eyeballing the board it does
    seem like the best path goes R -> 3 -> 4 -> 5 -> 6 -> 2 -> 7 -> 8 -> 1 -> 9 -> 10 = length 21....

    please advise if i'm missing something with the test case descriptions, but the opther 62 test cases pass...

  • Custom User Avatar

    def better, but i'm biased :)

  • Custom User Avatar

    This is the right soln. it be (real) analytical

  • Custom User Avatar

    pretty much the only challenging part is checking if number is prime, or iterating primes to a large enough bound within the time limit.

  • Custom User Avatar

    Kinda crap. Test cases so cumbersome that the only way to solve the problem is to look for the explicit formula. No coding skill required.

  • Custom User Avatar

    What kind of witchcraft is 'arr[0::,-1::-1].transpose()'?

  • Custom User Avatar

    if i is a square wouldn't your code add it's root twice to divs?

  • Custom User Avatar

    I pretty much did this! I would have never thought of some of the solutions above :p

  • Custom User Avatar
  • Loading more items...