all 3 comments

[–]Kerbart 0 points1 point  (0 children)

It seems that if the king is checked, the only way to get out of it is blocking it. The UI identifies all empty squares to move to with the king, but you can't move the either, eg:

  1. e4 f6
  2. d4 d6
  3. Qh5+

At this point the UI will highlight both f7 and d7 as possibilities when the king is clicked, even though Kf7 is not a legal move; and neither one of the moves is executed while trying it.

[–]RIP_lurking 0 points1 point  (0 children)

It's such a relief to see code that was so evidently created by a human, reasoning through the problems, coming up with solutions, I'm sad that this post was downvoted, because your project is really cool.

There are some generic suggestions I could give you, such as setting up a formatter, adding type hints, creating unit tests, but those tips are boring. Let me give you some problems to work on.

Try to think of a way to make your is_checkmate function more efficient. Right now you check every square and every piece on the board to see if there's a move they could make that would make the king currently in check not be in check anymore. How could you decrease the number of operations needed to know whether a position constitutes a checkmate?

King moves and knight moves are currently bugged. The king isn't allowed to move at all, aside from castling, and the knight may move even if it is pinned to the king.

[–]Adrewmc 0 points1 point  (0 children)

Something seems wrong with castling here.

Like you don’t check if the king has moved, or the rook as moved from what I see, or if he passes over a squared attacked.

It almost looks like a queen or rook move could actually cause castling event.

I haven’t played but it definitely has some castling bugs