示例#1
0
        public void Update()
        {
            while (gamestate == GameState.Playing)
            {
                uic.DrawBoard(board);
                Console.WriteLine();

                List <int> allowedMoves = rules.AllowedMoves(board, activePlayer);
                if (allowedMoves.Count == 0)
                {
                    gamestate = GameState.GameOver;
                    break;
                }
                board = rules.Move(uic.GetMove(allowedMoves, activePlayer), board, activePlayer);

                if (rules.PlayerSwapped)
                {
                    if (activePlayer == 1)
                    {
                        activePlayer = 2;
                    }
                    else
                    {
                        activePlayer = 1;
                    }
                }
            }
            uic.EndOfGameMessage(rules.CalculateWinners(board));
            if (uic.StartWithSameSettings())
            {
                ResetGame(ruleType, holes, stones);
            }
            else
            {
                SetUpGame();
            }
        }