コード例 #1
0
ファイル: ConsolePlayer.cs プロジェクト: henceee/1dv607_2015
        public void Play(model.DiceGame a_game)
        {
            String message = "Welcome to the cool Dice Game. Press any Key to play, or q to Quit";

            System.Console.WriteLine(message);

            while (System.Console.ReadKey().KeyChar != 'q')
            {
                System.Console.Clear();
                System.Console.WriteLine(message);
                if (a_game.Play())
                {
                    System.Console.WriteLine("You are a winner: {0} {1}", a_game.GetDice1Value(), a_game.GetDice2Value());
                }
                else
                {
                    System.Console.WriteLine("Sorry you lost: {0} {1}", a_game.GetDice1Value(), a_game.GetDice2Value());
                }
            }
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: henceee/1dv607_2015
        public void PlayGame(model.DiceGame a_game, view.Console a_view)
        {
            a_view.DisplayInstructions();

            while (a_view.WantsToPlay())
            {
                a_view.DisplayInstructions();

                a_view.DisplayResult(a_game.Play(), a_game.GetDice1Value(), a_game.GetDice2Value());

            }
        }