Пример #1
0
        public void placingPhase()
        {
            PlaceAction act = PlaceAction.Place;

            while (referee.inPlacing(xPlayer, oPlayer) || act == PlaceAction.Shoot)
            {
                gameBoard.Display($@"X stones:{xPlayer.stones} O stones:{oPlayer.stones}");
                if (act == PlaceAction.Place)
                {
                    switch (gameBoard.Place(currPlayer, referee))
                    {
                    case PlaceResult.Invalid: break;

                    case  PlaceResult.Done:
                        if (currPlayer == xPlayer)
                        {
                            currPlayer = oPlayer;
                        }
                        else
                        {
                            currPlayer = xPlayer;
                        }
                        break;

                    case  PlaceResult.MillMade: act = PlaceAction.Shoot;  break;
                    }
                }
                else
                {
                    if (gameBoard.Shoot(currPlayer, referee) == ShootResult.Done)
                    {
                        act = PlaceAction.Place;
                        if (currPlayer == xPlayer)
                        {
                            currPlayer = oPlayer;
                        }
                        else
                        {
                            currPlayer = xPlayer;
                        }
                    }
                }
            }
        }