示例#1
0
        public static void Start()
        {
            Console.WriteLine("\nFrise Début\n");
            Game           model      = new Game(); // Creation of the board and the players
            GameView       view       = new GameView();
            GameController controller = new GameController(model, view);

            Street Board   = model.Board;
            Player players = model.Players;
            Banker banker  = Banker.CreateBanker();
            Deck   deck    = Deck.ReadDeck();

            //Console.WriteLine(deck.toString());

            controller.initializePlayers();

            players.displayAllPlayers();
            Console.WriteLine("This is the list of the players!");
            Console.WriteLine("Press any key to start the game...");
            controller.displayGame();
            Console.ReadLine();
            Console.Clear();

            controller.playGame();
        }
示例#2
0
        public void Card(String type)
        {
            Deck    deck       = Deck.ReadDeck();
            Content tmpContent = null;

            if (type.Equals("community"))
            {
                tmpContent = deck.Community.Pop();
            }
            else if (type.Equals("chance"))
            {
                tmpContent = deck.Chance.Pop();
            }
            Console.WriteLine(tmpContent.Request);

            String[] actions   = tmpContent.Action.Split(',');
            int[]    intAction = Array.ConvertAll(actions, s => int.Parse(s));

            for (int i = 0; i < intAction.Length; i++)
            {
                if (intAction[i] != 0)
                {
                    switch (i)
                    {
                    case 0:
                        this.Move(this.MoveTo(intAction[i]));
                        break;

                    case 1:
                        // A player can move forward with a certain number of steps
                        this.Move(intAction[i]);
                        break;

                    case 2:
                        // A player can win or lose money with cards
                        this.Money += intAction[i];
                        break;

                    case 3:
                        if (intAction[i] == 1)
                        {
                            this.GoToJail();
                        }
                        else if (intAction[i] == -1)
                        {
                            this.CardJail = true;;
                        }
                        break;
                    }
                }
            }
        }