public override List<string> GetBasicMoves(Board board) { var boardNum = board.GetBoardNumber(CurrentPos); var rowNum = board.GetCellRow(CurrentPos); var colNum = board.GetCellCol(CurrentPos); var moves = new List<String>(); var directions = White ? _WhiteDirections : _BlackDirections; for (var i = 0; i < (directions.Length) / 2; i++) { var currentCell = board.GetNeighborCell(board.GetCell(CurrentPos), directions[i, 0]); if (directions[i, 0] != directions[i, 1]) { currentCell = board.GetNeighborCell(currentCell, directions[i, 1]); if (currentCell != null && currentCell.HasPiece() && currentCell.GetPiece().White != this.White) { moves.Add(currentCell.GetName()); } } else { if (currentCell != null && !currentCell.HasPiece()) { moves.Add(currentCell.GetName()); } } } return moves; }
public override List<string> GetBasicMoves(Board board) { var moves = new List<string>(); foreach (var direction in Enum.GetValues(typeof(Board.CellNeighbor))) { var currentCell = board.GetNeighborCell(board.GetCell(CurrentPos), (Board.CellNeighbor)direction); while (currentCell != null && (currentCell.GetPiece() == null || currentCell.GetPiece().White != White)) { moves.Add(currentCell.GetName()); if (currentCell.HasPiece()) break; currentCell = board.GetNeighborCell(currentCell, (Board.CellNeighbor)direction); } } return moves; }
public override List<string> GetBasicMoves(Board board) { var moves = new List<String>(); foreach (var direction in Enum.GetValues(typeof(Board.CellNeighbor))) { var currentCell = board.GetNeighborCell(board.GetCell(CurrentPos), (Board.CellNeighbor)direction); if (currentCell != null && (!currentCell.HasPiece() || (currentCell.HasPiece() && currentCell.GetPiece().White != this.White))) { moves.Add(currentCell.GetName()); } if (!smallList.Contains((Board.CellNeighbor)direction)) { foreach (var dirc in smallList) { var tempCell = board.GetNeighborCell(currentCell, dirc); if (tempCell != null && (!tempCell.HasPiece() || (tempCell.HasPiece() && tempCell.GetPiece().White != this.White))) { moves.Add(tempCell.GetName()); } } } } for (var i = 0; i < (_directions.Length) / 2; i++) { var currentCell = board.GetNeighborCell(board.GetCell(CurrentPos), _directions[i, 0]); currentCell = board.GetNeighborCell(currentCell, _directions[i, 1]); if (currentCell != null && (!currentCell.HasPiece() || (currentCell.HasPiece() && currentCell.GetPiece().White != this.White))) { moves.Add(currentCell.GetName()); } foreach (var dirc in smallList) { var tempCell = board.GetNeighborCell(currentCell, dirc); if (tempCell != null && (!tempCell.HasPiece() || (tempCell.HasPiece() && tempCell.GetPiece().White != this.White))) { moves.Add(tempCell.GetName()); } } } return moves; }
public override List<string> GetBasicMoves(Board board) { var moves = new List<string>(); for (var i = 0; i < (_directions.Length)/2; i++) { var currentCell = board.GetNeighborCell(board.GetCell(CurrentPos), _directions[i,0]); currentCell = board.GetNeighborCell(currentCell, _directions[i, 1]); while (currentCell != null && (currentCell.GetPiece() == null || currentCell.GetPiece().White != White)) { moves.Add(currentCell.GetName()); if (currentCell.HasPiece()) break; currentCell = board.GetNeighborCell(currentCell, _directions[i, 0]); currentCell = board.GetNeighborCell(currentCell, _directions[i, 1]); } } return moves; }
public override List<string> GetBasicMoves(Board board) { var moves = new List<string>(); foreach (var mainDirc in Enum.GetValues(typeof(Board.CellNeighbor))) { var mainCell = board.GetNeighborCell(board.GetCell(CurrentPos), (Board.CellNeighbor)mainDirc); if (mainCell == null) continue; mainCell = board.GetNeighborCell(mainCell, (Board.CellNeighbor)mainDirc); if (mainCell == null) continue; foreach(var secondaryDirc in Enum.GetValues(typeof(Board.CellNeighbor))) { var checkCell = board.GetNeighborCell(mainCell, (Board.CellNeighbor)secondaryDirc); if (board.IsSameOrOpposite((Board.CellNeighbor)mainDirc, (Board.CellNeighbor)secondaryDirc) || checkCell == null || (checkCell.GetPiece() != null && checkCell.GetPiece().White == this.White)) continue; moves.Add(checkCell.GetName()); } } return moves; }