Esempio n. 1
0
        static void Main(string[] args)
        {
            Game     g = new Game();      //keeps the game state, and is initialized by the constructor, so we are already good to go
            User     p = new User(g);     //represents the user player
            Computer c = new Computer(g); //represents the computer player

            //  main loop
            while (g.get_turns() < g.get_max_turns())
            {
                //
                //Console.ForegroundColor = Game.board;
                Console.BackgroundColor = Game.bg;
                p.take_turn();
                if (g.get_win())
                {
                    g.display_win(Game.player, g);
                    break;
                }
                c.take_turn();
                if (g.get_win())
                {
                    g.display_win(Game.comp, g);
                    break;
                }
            }
            g.log_game();
            Console.ReadKey();
        }