Beispiel #1
0
        public PlayGame(Game game, IView view)
        {
            a_game = game;
            a_view = view;

            a_game.AddSubscribers(this);
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     model.Game g = new model.Game();
     view.IView v = new view.SimpleView(); //new view.SwedishView(); for Swedish
     controller.PlayGame ctrl = new controller.PlayGame(v);
     g.Register(ctrl);
     while (ctrl.Play(g));
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            model.Game g = new model.Game();
            view.IView v = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame();

            while (ctrl.Play(g, v));
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            model.Game g = new model.Game();
            view.IView v = new view.SimpleView(); // new view.SwedishView();
            model.PlayGame c = new model.PlayGame();
            g.ObserveCards(c);

            while (c.Play(g, v)) ;
        }
Beispiel #5
0
 static void Main(string[] args)
 {
     view.IView          v    = new view.SimpleView(); // new view.SwedishView();
     controller.PlayGame ctrl = new controller.PlayGame(v);
     model.Game          g    = new model.Game(ctrl);
     while (ctrl.Play(g))
     {
         ;
     }
 }
        static void Main(string[] args)
        {
            model.Game g = new model.Game();
            view.IView v = new view.SimpleView(); // new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame();

            //Register controller as listener to the card add
            g.SubscribeToCardAdds(ctrl);

            while (ctrl.Play(g, v));
        }
Beispiel #7
0
 static void Main(string[] args)
 {
     model.Game          g    = new model.Game();
     view.IView          v    = /*new view.SimpleView(); */ new view.SwedishView();
     controller.PlayGame ctrl = new controller.PlayGame(g, v);
     g.subscribToCards(ctrl);
     while (ctrl.Play())
     {
         ;
     }
 }
Beispiel #8
0
        static void Main(string[] args)
        {
            model.Game          g    = new model.Game();
            view.IView          v    = new view.SwedishView(); // new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame(v, g);

            while (ctrl.Play())
            {
                ;
            }
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            view.IView          v    = new view.SimpleView(); // new view.SwedishView();
            model.Game          g    = new model.Game((model.IExcitingObserver)v);
            controller.PlayGame ctrl = new controller.PlayGame();

            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            // TESTAR....
            model.Game          g    = new model.Game();
            view.IView          v    = new view.SimpleView(); // new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame(g, v);

            while (ctrl.Play())
            {
                ;
            }
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            model.Game          g    = new model.Game();
            view.IView          v    = new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame(g, v);

            g.RegisterSubscriber(ctrl);
            while (ctrl.Play())
            {
                ;
            }
        }
        static void Main(string[] args)
        {
            model.Game g = new model.Game();
            view.IView v = new view.ConsoleView(); // new view.ConsoleView("S");

            controller.PlayGame ctrl = new controller.PlayGame(g, v);

            while (ctrl.Play())
            {
                ;
            }
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            model.Game          g    = new model.Game();
            view.IView          v    = new view.SimpleView(); // new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame();

            g.SubscriptionToNewCards(ctrl);

            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            model.rules.AbstractRulesFactory ruleSet = new model.rules.EasyRulesFactory();
            //model.rules.AbstractRulesFactory ruleSet = new model.rules.HardRulesFactory();

            model.Game g = new model.Game(ruleSet);
            view.IView v = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame();

            g.Subscribe(ctrl);

            while (ctrl.Play(g, v));
        }
Beispiel #15
0
        private static void InitializeApp()
        {
            model.Game                   g    = new model.Game();
            view.IView                   v    = new view.SimpleView(); // new view.SwedishView();
            controller.PlayGame          ctrl = new controller.PlayGame();
            controller.DealtCardObserver o    =
                new controller.DealtCardObserver(g, v);

            while (ctrl.Play(g, v, o))
            {
                ;
            }
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            model.Game          g    = new model.Game();
            view.IView          v    = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame();

            g.setPlayerListener(ctrl);

            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            model.Game g = new model.Game();// // ändrat til CardObserver
            view.IView v = new view.SimpleView(); // new view.SwedishView();
            controller.PlayGame ctrl = new controller.PlayGame(g, v); // ändrat

            g.SetPlayerObserver(ctrl);

            while (ctrl.Play()) ;// ändrat

            /*controller.PlayGame ctrl = new controller.PlayGame();
            while (ctrl.Play(g, v));*/
        }
Beispiel #18
0
        static void Main(string[] args)
        {
            model.Game game = new model.Game();
            var swedishView = false;
            view.IView view;
            if (swedishView)
                view = new view.SwedishView();
            else
                view = new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame(game, view);

            while (ctrl.Play());
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            view.IView          v        = new view.SimpleView();
            controller.PlayGame ctrl     = new controller.PlayGame();
            model.Dealer        m_dealer = new model.Dealer(new model.rules.RulesFactory());
            m_dealer.SubscriberList += ctrl.HandleEvent;

            model.Game g = new model.Game(m_dealer);

            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            model.Game g = new model.Game();
            view.IView v = new view.SimpleView(); // new view.SwedishView();

            model.IObserver co = new controller.CardObserver(g, v);
            g.AddCardObserver(co);

            controller.PlayGame ctrl = new controller.PlayGame();

            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #21
0
        static void Main(string[] args)
        {
            view.IView            v            = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame   ctrl         = new controller.PlayGame();
            List <model.Observer> observerList = new List <model.Observer>();

            observerList.Add(ctrl);
            model.Game g = new model.Game(observerList);


            while (ctrl.Play(g, v))
            {
                ;
            }
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            model.Dealer        d    = new model.Dealer(new model.rules.RulesFactory(), "Croupier");
            model.Player        p    = new model.Player("Player");
            model.Game          g    = new model.Game(d, p);
            view.IView          v    = new view.SwedishView();//new view.SimpleView();
            controller.PlayGame ctrl = new controller.PlayGame(v, g);

            d.Register(ctrl);

            while (ctrl.Play())
            {
                ;
            }
        }
Beispiel #23
0
 static void Main(string[] args)
 {
     model.Game          g    = new model.Game();
     view.IView          v    = new view.SwedishView();
     controller.PlayGame ctrl = new controller.PlayGame();
     try
     {
         while (ctrl.Play(g, v))
         {
             ;
         }
     }
     catch (Exception Ex)
     {
         WriteLine($"Something's gone horribly wrong!: {Ex.Message}");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            ruleSet = new EasyRulesFactory();
            //ruleSet = new model.rules.HardRulesFactory();


            game = HttpContext.Current.Session["Game"] as Game;
            if (game == null)
            {
                game = new Game(ruleSet);
                HttpContext.Current.Session["Game"] = game;
            }
            else
            {
                ShowResults();
            }
            game.Subscribe(this);
            setRules();
        }
        const bool c_runConsoleBased = false; //need to change output type in application (project) settings as well

        #endregion Fields

        #region Methods

        static void Main(string[] args)
        {
            model.rules.IRulesFactory rulesFactory = new model.rules.AmericanRulesFactory();
            model.Game g = new model.Game(rulesFactory);

            if (c_runConsoleBased)
            {
                view.IView v = new view.SwedishView(); // new view.SwedishView();
                controller.PlayGame ctrl = new controller.PlayGame(g, v);
                while (ctrl.Play());
            }
            else
            {
                BlackJack.view.FormView form = new BlackJack.view.FormView();
                view.IView v = form; // new view.SwedishView();
                controller.PlayGame ctrl = new controller.PlayGame(g, v);
                ctrl.Play();

                Application.Run(form);
            }
        }
Beispiel #26
0
 public PlayGame(view.IView a_view, model.Game a_game)
 {
     m_view = a_view;
     m_game = a_game;
 }
 public PlayGame(IView a_view, Game a_game)
 {
     m_view = a_view;
     m_game = a_game;
     m_game.AddSubscriber(this);
 }
 public PlayGame(Game game, IView view)//
 {
     a_game = game;
     a_view = view;
 }
 private void reset()
 {
     HttpContext.Current.Session["Game"] = null;
     game = new Game(ruleSet);
     save();
 }
Beispiel #30
0
 public PlayGame(Game a_game, view.IView a_view)
 {
     this.a_game = a_game;
     this.a_view = a_view;
 }