public IEnumerable <FigureOnSquare> YieldFigures() { foreach (Square square in Square.YieldSquares()) { if (GetFigureAt(square).GetColor() == moveColor) { yield return(new FigureOnSquare(GetFigureAt(square), square)); } } }
private Square FindBadKing() { Figure badKing = moveColor == Color.black ? Figure.whiteKing : Figure.blackKing; foreach (Square square in Square.YieldSquares()) { if (GetFigureAt(square) == badKing) { return(square); } } return(Square.none); }
void FindAllMoves() { allMoves = new List <FigureMoving>(); foreach (FigureOnSquare fs in board.YieldFigures()) { foreach (Square to in Square.YieldSquares()) { FigureMoving fm = new FigureMoving(fs, to); if (moves.CanMove(fm)) { allMoves.Add(fm); } } } }