コード例 #1
0
ファイル: Game.cs プロジェクト: AdriVanHoudt/School
        private void firstPlayerTurn()
        {
            _mainPage.output1.Text=_players[_currentPlayerNumber].getName();
              Boolean throwing = true;
              int counter= 0;
              while (throwing && (counter < 2))
              {
            Throw myThrow = new Throw();
            int score = myThrow.throwNow();
            int value = myThrow.getTotalValue();
            _mainPage.output2.Text=_maxScore + "   " + score;
            if ((score >= _maxScore))
            {
              if ((value > _maxValue))
              {
            _winningPlayerNumber = _currentPlayerNumber;
            _maxScore = score;
            _maxValue = value;
              }

            }
            _mainPage.output1.Text = "Wanna throw again?" + _players[_currentPlayerNumber].getName();
            _mainPage.btnThrowAgainY.Visibility = Visibility.Visible;
            _mainPage.btnThrowAgainN.Visibility = Visibility.Visible;
              if (Console.ReadLine().Equals("n"))
            {
              throwing = false;
            }
            else
            {
              counter++;
            }
              }
              _maxAmountOfTurns = counter;
              _mainPage.output1.Text=""+_maxAmountOfTurns;
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: AdriVanHoudt/School
        private void otherPlayer()
        {
            int counter= 0;
              while (counter <= _maxAmountOfTurns)
              {
              _mainPage.output1.Text = _players[_currentPlayerNumber].getName() + "   " + _currentPlayerNumber;
            Throw myThrow = new Throw();
            int score = myThrow.getScore();
            int value = myThrow.getTotalValue();
            _mainPage.output1.Text=_maxScore + "   " + score;
            if ((score >= _maxScore))
            {
              if ((value > _maxValue))
              {
            _winningPlayerNumber = _currentPlayerNumber;
            _maxScore = score;
            _maxValue = value;
              }

            }
            counter++;
              }
        }