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