コード例 #1
0
ファイル: GameManager.cs プロジェクト: jsnklpn/jatan
 /// <summary>
 /// Creates a new game instance.
 /// </summary>
 public GameManager()
 {
     _gameSettings = new GameSettings();
     _gameState = GameStates.NotStarted;
     _playerTurnState = PlayerTurnState.None;
     _gameBoard = new GameBoard();
     _players = new List<Player>();
     _developmentCardDeck = new CardDeck<DevelopmentCards>();
     _dice = new Dice();
     _tradeHelper = new TradeHelper();
     _playersCardsToLose = new Dictionary<Player, int>();
     _playersToStealFrom = new List<Player>();
 }
コード例 #2
0
ファイル: DiceTest.cs プロジェクト: jsnklpn/jatan
        public void TestRoll()
        {
            var dice = new Dice();

            int low = int.MaxValue;
            int high = int.MinValue;
            for (int i = 0; i < 10000; i++)
            {
                int roll = dice.Roll();
                if (roll < low)
                    low = roll;
                if (roll > high)
                    high = roll;
            }

            Assert.AreEqual(2, low, "The lowest roll should be a 2.");
            Assert.AreEqual(12, high, "The highest roll should be a 12.");
        }
コード例 #3
0
ファイル: DiceTest.cs プロジェクト: jsnklpn/jatan
        public void TestLog()
        {
            var dice = new Dice();
            int rollCount = 100;
            var log = new int[rollCount];

            for (int i = 0; i < rollCount; i++)
            {
                int roll = dice.Roll();
                log[i] = roll;
            }

            Assert.AreEqual(rollCount, dice.RollLog.Count, "The log is not the correct size.");
            for (int i = 0; i < rollCount; i++)
            {
                Assert.AreEqual(log[i], dice.RollLog[i], "The values in the log should be the same.");
            }
        }