2 kyu

Chess - checkmate with rook in 16 moves

15 of 41user6793616
Description
Loading description...
Games
Performance
Algorithms
  • Please sign in or sign up to leave a comment.
  • mjpieters Avatar

    I have created a rust translation, please review and approve!

  • mjpieters Avatar

    I think the random tests are somewhat limited. The 500 tests pick from 916 unique boards (generated from 121 base triples, then rotated or mirrored, with a bit of overlap between rotations for 52 of those).

    I know one of my solutions had a bug in how states were generated where it missed some options, and I was wondering why the random tests never touched on those positions. Now I know why!

    There are nearly 10k possible chess board arrangements that would make a valid test:

    1. with the black king not at the edge, and not within range of the white pieces
    2. with the white pieces not within range of the black king, or where only the white rook is in range but protected by the white king.
    3. where the white king is not positioned between the black and white kings.

    Is there any reason why these are not simply properly randomly generated?

  • mjpieters Avatar

    This comment has been hidden.

  • seniorCrutchDeveloper Avatar

    It's incredibly satisfying to finally be finished. It wasn't easy, thanks for a great and challenging kata. IMHO, it was closer to 1kuy than to 2kuy. And I agree with comment @Voile, I think this is indeed a problem and should be taken into consideration.

  • Voile Avatar

    This comment has been hidden.

  • Voile Avatar

    Node version needs to be upgraded from v8.

  • lsnbr Avatar

    This comment has been hidden.

  • Kacarott Avatar

    Working through the kata, a really nice bonus feature would be a visualisation of the board on failure, similiar to some of the "Play Game" series katas. Here you could directly just use ASCII as there are unicode symbols for the pieces I believe.

    Just an idea :)

  • ᛚᚨᚱᛊ ᚺᛖᚾᚱᛁᚲ Avatar

    Why is this kata listed in the 8kyu section?

  • user6793616 Avatar

    This kata is feeling so lonesome...

  • Voile Avatar

    There is a magical function that prevents user code from tampering your objects, and that is Object.freeze ;-)

  • Blind4Basics Avatar

    The sample tests do not respect the contract: with them, you are asking for some "somewhat specific implementations" that will identify the perfect move to make mate in one move, but maybe the user could still make the checkmate in less than 16 moves, doing something else. I still didn't press attempt, so I don't know if that's the same for the full test suite, but if so, you have to change the way you test the solution of the user (or to change the contract/description)

  • Blind4Basics Avatar
    • Why do you provide the code defining the properties in the solution setup? Are they used in the tests? If so, that should be said in the desription. If not... you shouldn't provide that code. ;)
    • the definition of the black king position in the constructor seems useless (for now), since it plays before the whites. Shouldn't it be removed from the input?

    EDIT:

    • python 3.6 isn't allowed. Is that wanted? Note that python 2.7 is currently unavailable too and that's good: it's notably faster than py3+.
    • btw, how much tests are there? Maybe you could add the info to the description. (I didn't press attempt yet...)