private bool IsThroughCheck(Move move, BoardState boardState) { var color = boardState.PiecePositions[move.StartPosition.X, move.StartPosition.Y].Color; if (MoveValidator.IsSquareAttacked(move.StartPosition, color, boardState)) { return(true); } for (int x = move.StartPosition.X; x != move.EndPosition.X; x += Math.Sign(move.EndPosition.X - move.StartPosition.X)) { var position = new Coordinate { X = x, Y = move.StartPosition.Y }; if (MoveValidator.IsSquareAttacked(position, color, boardState)) { return(true); } } return(false); }