Beispiel #1
0
        public static string PrintCoordinates(IEnumerable <ICellCoordinates> cells)
        {
            var    resultNames      = cells.Select(c => BoardCoordinatesConverter.CoordinatesToCellName(c));
            string debugResultNames = String.Join("; ", resultNames.ToArray());

            return(debugResultNames);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void TryConsumeNamedCellByBlackPlayer(string cellName, bool isBlackPlayer)
        {
            ICellCoordinates cellPosition = BoardCoordinatesConverter.CellNameToCoordinates(cellName);

            this.TryConsumeCellByBlackPlayer(cellPosition, isBlackPlayer);
        }