Exemplo n.º 1
0
 public virtual IEnumerable<Board> PossibleMoves(Board currentBoard, byte row, byte col)
 {
     var currentLoc = new Loc(row, col);
     foreach (var loc in TilesCovered(currentBoard, row, col))
     {
         if (!currentBoard.IsOccupied(loc, IsWhite))
             yield return currentBoard.WithNewLocation(currentLoc, loc);
     }
 }
Exemplo n.º 2
0
        public virtual IEnumerable <Board> PossibleMoves(Board currentBoard, byte row, byte col)
        {
            var currentLoc = new Loc(row, col);

            foreach (var loc in TilesCovered(currentBoard, row, col))
            {
                if (!currentBoard.IsOccupied(loc, IsWhite))
                {
                    yield return(currentBoard.WithNewLocation(currentLoc, loc));
                }
            }
        }
Exemplo n.º 3
0
 public override IEnumerable<Board> PossibleMoves(Board currentBoard, byte row, byte col)
 {
     var currentLoc = new Loc(row, col);
     var boards = new List<Board>();
     foreach (var loc in TilesCovered(currentBoard, row, col))
     {
         if (!currentBoard.IsCovered(IsWhite, loc))
         {
             boards.Add(currentBoard.WithNewLocation(currentLoc, loc));
         }
     }
     return boards;
 }
Exemplo n.º 4
0
        public override IEnumerable <Board> PossibleMoves(Board currentBoard, byte row, byte col)
        {
            var currentLoc = new Loc(row, col);
            var boards     = new List <Board>();

            foreach (var loc in TilesCovered(currentBoard, row, col))
            {
                if (!currentBoard.IsCovered(IsWhite, loc))
                {
                    boards.Add(currentBoard.WithNewLocation(currentLoc, loc));
                }
            }
            return(boards);
        }
Exemplo n.º 5
0
        public override IEnumerable<Board> PossibleMoves(Board currentBoard, byte row, byte col)
        {
            var direction = -1;
            if (IsWhite) direction = 1;

            if (row + direction < 0 || row + direction > 7)
                yield break;

            var newLoc = new Loc(row + direction, col);
            var currentLoc = new Loc(row, col);
            if (!currentBoard.IsOccupied(newLoc))
            {
                yield return currentBoard.WithNewLocation(currentLoc, newLoc);
            }
        }
Exemplo n.º 6
0
        public override IEnumerable <Board> PossibleMoves(Board currentBoard, byte row, byte col)
        {
            var direction = -1;

            if (IsWhite)
            {
                direction = 1;
            }

            if (row + direction < 0 || row + direction > 7)
            {
                yield break;
            }

            var newLoc     = new Loc(row + direction, col);
            var currentLoc = new Loc(row, col);

            if (!currentBoard.IsOccupied(newLoc))
            {
                yield return(currentBoard.WithNewLocation(currentLoc, newLoc));
            }
        }