Answers.Body: <p>The rules governing chess are the <a href="https://handbook.fide.com/chapter/E012018" rel="noreferrer">FIDE Laws of Chess</a>. This point is explicitly covered in <strong>Article 3: The moves of the pieces</strong></p>
  <blockquote>
  <p>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.</p>
  </blockquote>
  <p>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.</p>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-14T21:19:43.673Z
Answers.LastActivityDate: 2022-01-14T21:19:43.673Z
Answers.UserDisplayName: Brian Towers
Body: <p>I'm currently writing my own chess game with my own AI and have a Question about a move:
  <a href="https://i.sstatic.net/mIpWF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mIpWF.png" alt="enter image description here" /></a></p>
  <p>Here, Purple moved his Pawn from F2 -&gt; F3, which allowes the Green Queen on H4 to capture the King, and I wondered if the F2 -&gt; F3 move is illegal or if it's just an oversight of the player which lost him the game.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-15T19:09:12.050Z
Comments.Text: 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.
Comments.UserDisplayName: njzk2
Tags: <rules><fide><illegal-move>
Title: Is this move illegal?
ThreadText: # Is this move illegal?
  
  (Asked by: username_0 on 2022-01-14)
  
  I'm currently writing my own chess game with my own AI and have a Question about a move:
  [![enter image description here](https://i.sstatic.net/mIpWF.png)](https://i.sstatic.net/mIpWF.png)
  
  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.
  
  **Tags:** rules, fide, illegal-move
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-01-14. Score: 11
  
  The rules governing chess are the [FIDE Laws of Chess](https://handbook.fide.com/chapter/E012018). 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.
  
  
  ---
  
  