示例#1
0
        static void Main(string[] args)
        {
            const int GAMESCOUNT = 20;

            Feedback report = new Feedback();
            Game     game   = new Game(ref report);

            Dice  dice  = new Dice();
            House house = new House(ref dice);

            report.Rules(); // prints the rules

            for (int i = 1; i <= GAMESCOUNT; i++)
            {
                report.Log($"---- Game #{i} ----");
                game.play(house);
            }
        }
示例#2
0
        public void play(House house)
        {
            int         roundResult;
            DiceOutcome outcome = DiceOutcome.LENGTH;

            do
            {
                roundResult = house.PlayRound();

                m_report.Log("Player rolled: " + roundResult);

                outcome = house.CheckResult(ref roundResult);

                if (outcome == DiceOutcome.LOSE)
                {
                    m_report.Lose(); break;
                }
                else if (outcome == DiceOutcome.WIN)
                {
                    m_report.Win(); break;
                }
            } while (true);
        }