Пример #1
0
        private void _UpdateLottery(IterationData data)
        {
            bool fLossCondition = false;

            // Here we'll assume there's two teams.

            bool fBlueLoss = data.GetData(Team.Blue, UserState.Clicked) < _uThreshold;
            bool fRedLoss = data.GetData(Team.Red, UserState.Clicked) < _uThreshold;
            if (fBlueLoss && fRedLoss)
            {
                // Both teams lose
                // Grow the lottery even more, keep the threshold the same
                _uLottery = (uint)(_uLottery * c_dLotteryGrowth);
            }
            else if (fRedLoss)
            {
                // Blue wins
                _uBlueScore += _uLottery;
                _ResetGame();

            }
            else if (fBlueLoss)
            {
                // Red wins
                _uRedScore += _uLottery;
                _ResetGame();
            }
            else
            {
                // No winner
                _uThreshold = (uint) Math.Ceiling(_uThreshold * c_dThresholdGrowth);
            }

            // Update the total lottery
            _uLotteryTotal += _uLottery;
        }
Пример #2
0
        private void _UpdateUI(IterationData data)
        {
            Console.WriteLine(_users.Count);
            Console.Write(data.uIteration + "\t");
            Console.Write(data.uThreshold + "\t");

            foreach (Team team in Enum.GetValues(typeof(Team)))
            {
                foreach (UserState state in Enum.GetValues(typeof(UserState)))
                {
                    Console.Write(data.GetData(team, state) + "\t");
                }
            }

            Console.WriteLine();
        }