Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hardcoding past any suite of fixed tests is nothing more than a regex replace of the reporter output. Random tests are always needed.
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!
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.
duplicate issue
Needs random tests.
.
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 :)
yep,algorithms are easy but to keep the code clean and joining everything together is the challenge.
Awesome kata!!
In c# test
expected
andbut was
answers are flipped (at least for isCheck).I just found the same error, Still not fixed :(
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.
Is this kate's answer very long?It very hard to me.I think it will cost me a whole day.
In the php sample tests, testQueen() has text "Bishop threatens king!", should update to "Queen threatens king!"
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.
Loading more items...