Chess Engine in C Part 6: How Attacked Squares Are Detected

The sixth installment of a series on building a chess engine in C focuses on detecting attacked squares. An attacked square is one a piece could move to and capture on, regardless of whether a piece currently occupies it. The author explains how each piece's movement pattern is encoded using direction offsets on a 12x10 mailbox board. A SqAttacked function then checks pawns, knights, sliding rooks and queens, bishops and queens, and kings in turn to decide whether a given square is under attack by a specified side.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in