Esempio n. 1
0
File: Chess.cs Progetto: Dloz/Chess
 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());
             }
         }
     }
 }
Esempio n. 2
0
        private bool CanEatKing()
        {
            var badKing = FindBadKing();
            var moves   = new Moves(this);

            return(YieldFigures().Select(fs => new FigureMoving(fs, badKing)).Any(fm => moves.CanMove(fm)));
        }