public static string PrintCoordinates(IEnumerable <ICellCoordinates> cells) { var resultNames = cells.Select(c => BoardCoordinatesConverter.CoordinatesToCellName(c)); string debugResultNames = String.Join("; ", resultNames.ToArray()); return(debugResultNames); }
public IEnumerable <ICellCoordinates> GetEmptyEnemyNeighbours() { IEnumerable <ICellCoordinates> enemyCells = this.FlattenCells() .Where(c => this.IsCellTakenByInactivePlayer(c)); IEnumerable <ICellCoordinates> result = enemyCells.SelectMany(c => this.GetNeighboursForCell(c)) .Where(c => this.IsCellFree(c)) .Distinct(); string debugResultNames = BoardCoordinatesConverter.PrintCoordinates(result); Debug.WriteLine(debugResultNames); return(result); }
public void TryConsumeNamedCellByBlackPlayer(string cellName, bool isBlackPlayer) { ICellCoordinates cellPosition = BoardCoordinatesConverter.CellNameToCoordinates(cellName); this.TryConsumeCellByBlackPlayer(cellPosition, isBlackPlayer); }