1

I'm currently writing my own chess game with my own AI and have a Question about a move: enter image description here

Here, Purple moved his Pawn from F2 -> F3, which allowes the Green Queen on H4 to capture the King, and I wondered if the F2 -> F3 move is illegal or if it's just an oversight of the player which lost him the game.

1
  • 3
    the term for this situation is that the pawn in f2 is pinned by the queen, which is to say that it is not allowed to move because it would put the king in check.
    – njzk2
    Jan 15, 2022 at 19:09

1 Answer 1

11

The rules governing chess are the FIDE Laws of Chess. This point is explicitly covered in Article 3: The moves of the pieces

3.9.2 No piece can be moved that will either expose the king of the same colour to check or leave that king in check.

The move f3 violates this rule because it exposes the king to check. As such it is an illegal move. Your program should not allow illegal moves so should not allow this move in just the same way that you do not allow the pawn to move from f2 to f5 in one move.

In a real game when an illegal move is made the move must be taken back and a legal move made in its place. In competition chess there are also penalties for making illegal moves.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.