Ad
  • Default User Avatar

    I'd really like to see this beautiful and highly-rated kata get approved. But since the author hasn't been active since 2017, it seems unlikely that the outstanding issues will be resolved. So I have forked the Python translation at https://www.codewars.com/kumite/6494c6edbefb703537c0bfd3?sel=6494c6edbefb703537c0bfd3 , and made the following changes:

    (1) Greatly increased the number of fixed tests. These consider, somewhat systematically, various types of checking positions, and whether they are mate or not.

    (2) Added random tests. These sometimes generate illegal chess positions (like a king being checked by 3 pieces), but the functions should still work. Also, only about 10% of them are mates. (I'm not sure if the random tests are really needed, given the number of fixed tests, which would be very tedious to hardcode.)

    (3) Clarified the description, especially the use of the previous piece location and enpassant.

    NOTE: I had to remove the statements that print the outputboard for the first few sections of fixed tests, otherwise the console got overloaded and it wouldn't publish. Not quite sure if these can, or need, to be put back.

    I'm hoping that we can use this Python version to agree on the standards for approval, and then get the other languages done. Then hopefully it can be moved out of beta!

  • Custom User Avatar

    I loved making the Kata! If I had to name 1 thing, it would be that the test are suggesting a particular solution a bit too much. I would have prefered it if the test only check if given certain positions, isMate returns the correct value. With my solution I had to write a lot of helper function just to confirm to the format the tests are implying.

  • Custom User Avatar

    duplicate issue

  • Default User Avatar

    Needs random tests.

  • Default User Avatar

    .

  • Default User Avatar

    Very cool and exciting kata!
    Did anyone think that would be a first step to build own chess engine?
    Maybe very basic (use random move at least) but able to make valid moves,
    look if add here handling of specific conditions like stalemate and castling, and here we got formally working engine with support of all chess rules. Is not it great?
    Maybe sometime i could master my own kata on this, if nobody haven't done yet :)

  • Default User Avatar

    yep,algorithms are easy but to keep the code clean and joining everything together is the challenge.

  • Default User Avatar

    Awesome kata!!

  • Default User Avatar

    In c# test expected and but was answers are flipped (at least for isCheck).

  • Default User Avatar

    I just found the same error, Still not fixed :(

  • Default User Avatar
    A	B	C	D	E	F	G	H
    

    8 ♛ ♚
    7
    6
    5
    4 ♙ ♛
    3 ♙
    2 ♙ ♙ ♙
    1 ♕ ♔ ♗ ♘ ♖

    [{'y': 4, 'owner': 0, 'piece': 'pawn', 'x': 6}, {'y': 5, 'owner': 0, 'piece': 'pawn', 'x': 5}, {'y': 6, 'owner': 0, 'piece': 'pawn', 'x': 3}, {'y': 6, 'owner': 0, 'piece': 'pawn', 'x': 4}, {'y': 6, 'owner': 0, 'piece': 'pawn', 'x': 7}, {'y': 7, 'owner': 0, 'piece': 'queen', 'x': 3}, {'y': 7, 'owner': 0, 'piece': 'king', 'x': 4}, {'y': 7, 'owner': 0, 'piece': 'bishop', 'x': 5}, {'y': 7, 'owner': 0, 'piece': 'knight', 'x': 6}, {'y': 7, 'owner': 0, 'piece': 'rook', 'x': 7}, {'prevX': 3, 'y': 4, 'piece': 'queen', 'x': 7, 'owner': 1, 'prevY': 0}, {'y': 0, 'owner': 1, 'piece': 'king', 'x': 4}] 1
    A B C D E F G H
    8 ♛ ♚
    7
    6
    5
    4 ♙ ♛
    3 ♙
    2 ♙ ♙ ♙
    1 ♕ ♔ ♗ ♘ ♖

    How is it 1's turn if 1's queen was just moved (presence of prevX and prevY)??The test just above this one makes more sense as it is almost the same test except it is 0's turn but in this test the placement is exactly same except it is 1's turn which is not logical because 1's queen was just moved.Plus white king is being checked in it but it shows that it is black's turn which is an impossible situation.

  • Custom User Avatar

    Is this kate's answer very long?It very hard to me.I think it will cost me a whole day.

  • Default User Avatar

    In the php sample tests, testQueen() has text "Bishop threatens king!", should update to "Queen threatens king!"

  • Custom User Avatar

    Ideally, all positions need to be clear about the previous move. But, as we both agree that previous position matters for en passant cases only, for tesing purposes you can ommit it if it's not en passant situation as it does not matter what piece made the last move. If you worried about getting an error while reading the previous position, use an error free reading option. Not sure what language you are using, but Python has one.

    Another thing that's not perfect: I encountered one test that is not correct: a king is under a check, but a move belongs to the other player. I provided details in my other post below.

  • Default User Avatar

    Correct, I believe my comment was not clear. What I meant is that the previous position information is useful in this particular case only. It seems the whole parameter is designed around this one case. And also, in some tests the previous position is not correctly set (it is empty)

  • Loading more items...