Beispiel #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);
     }
 }
Beispiel #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));
                }
            }
        }
Beispiel #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;
 }
Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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));
            }
        }