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

            this.TryConsumeCellByBlackPlayer(cellPosition, isBlackPlayer);
        }