예제 #1
0
파일: Board.cs 프로젝트: mistergad/Chess
 public IEnumerable <FigureOnSquare> YieldFigures()
 {
     foreach (Square square in Square.YieldSquares())
     {
         if (GetFigureAt(square).GetColor() == moveColor)
         {
             yield return(new FigureOnSquare(GetFigureAt(square), square));
         }
     }
 }
예제 #2
0
파일: Board.cs 프로젝트: mistergad/Chess
        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);
        }
예제 #3
0
 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);
             }
         }
     }
 }