Example #1
0
        public List <Tuple <int, int> > GetAvailableCells()
        {
            var availableCells = field.GetAvailableCells(currentPlayerColor);

            AvailableCellsCalculated?.Invoke(availableCells);
            return(availableCells);
        }
Example #2
0
        public void MakeMove(Tuple <int, int> coords)
        {
            if (GetAvailableCells().Count == 0)
            {
                ChangedTurn();
                if (IsGameFinished())
                {
                    FinishGame(GetCells());
                }
            }
            else
            {
                PassedMovesCount = 0;
            }

            var cells = MarkCell(CurrentPlayerColor, coords, _board.Cells);

            MoveMade?.Invoke(cells);
            SwitchPlayer();
            AvailableCellsCalculated?.Invoke(GetAvailableCells());
            CalculatePlayersScore(cells);
            if (IsFull(cells) || PassedMovesCount == 2)
            {
                FinishGame(cells);
                return;
            }
            _board = new Board(cells);
        }
Example #3
0
        public void StartGame()
        {
            CurrentPlayerColor = _firstPlayerColor;

            _board.SetBlackHole(GenerateBlackHoleCoords());

            GameStarted?.Invoke(_board.Cells);

            var availableCells = GetAvailableCells();

            AvailableCellsCalculated?.Invoke(availableCells);
        }