示例#1
0
        private void SelectPiecesAndPlayOrder()
        {
            board = new Board();

            runner.DisplayInfoUser("Welcome! I am Charlie Checker");
            runner.DisplayPromptToUser("What's your name? ");
            string name = runner.GetStringInputFromUser();

            int choice;

            runner.DisplayInfoUser("Hi " + name + ", please select your game pieces\r\n");
            runner.DisplayInfoUser("[1] X X X X X X X X X X X X    (Plays First)");
            runner.DisplayInfoUser("[2] O O O O O O O O O O O O");
            runner.DisplayPromptToUser("\r\nEnter your choice [1 or 2]: ");

            choice = runner.GetMenuSelectionFromUser();
            while (choice != 1 &&
                   choice != 2)
            {
                runner.DisplayErrorUser("Invalid choice.  Please enter 1 or 2 only");
                runner.DisplayInfoUser("[1] X X X X X X X X X X X X    (Plays First)");
                runner.DisplayInfoUser("[2] O O O O O O O O O O O O");
                runner.DisplayPromptToUser("\r\nEnter your choice [1 or 2]: ");

                choice = runner.GetMenuSelectionFromUser();
            }

            if (choice == 1)
            {
                computer   = new Player("Charlie Checker", Board.BACKWARD);
                human      = new Player(name, Board.FORWARD);
                bTurnHuman = true;
            }
            else
            {
                computer   = new Player("Charlie Checker", Board.FORWARD);
                human      = new Player(name, Board.BACKWARD);
                bTurnHuman = false;
            }
        }