public IEnumerable <string> YieldValidMoves() { foreach (FigureOnSquare fs in _board.YieldFigures()) { foreach (Square to in Square.YieldSquares()) { FigureMoving fm = new FigureMoving(fs, to); if (moves.CanMove(fm)) { yield return(fm.ToString()); } } } }
private bool CanEatKing() { var badKing = FindBadKing(); var moves = new Moves(this); return(YieldFigures().Select(fs => new FigureMoving(fs, badKing)).Any(fm => moves.CanMove(fm))); }