示例#1
0
        static void Main(string[] args)
        {
            ChooseNumberOfPlayers();
            Player winner = StartGame();

            UI.WriteLine("El ganador es {0}", winner);
            UI.ReadLine();
        }
示例#2
0
        public void Move()
        {
            int die1 = Program.RNG.Next(1, 7);
            int die2 = Program.RNG.Next(1, 7);

            UI.WriteLine("Dados: {0}", die1 + die2);
            UI.WriteLine("Posición anterior: {0}", Position);
            Position += die1 + die2;
            UI.WriteLine("Posición nueva: {0}", Position);
        }
示例#3
0
        public void Play()
        {
            if (!Playing)
            {
                return;
            }

            UI.Clear();
            UI.WriteLine("Turno: {0}", this);
            UI.WriteLine("Propiedades: {0}", string.Join(", ", Properties));
            UI.WriteLine("Ferrocarriles: {0}", string.Join(", ", Railroads));
            UI.WriteLine();
            Move();
            Space space = Board.GetSpaceAt(Position);

            UI.WriteLine("{0} cayó en {1}.", this, space);
            UI.WriteLine();
            space.ReceivePlayer(this);

            UI.ReadLine();
        }
示例#4
0
 public override void ReceivePlayer(Player player)
 {
     if (Owner == null)
     {
         UI.WriteLine("{0} no tiene dueño.", this);
         if (UI.ChooseBoolean("¿Desea comprarla? (s: sí, N: no)"))
         {
             if (player.Money < Price)
             {
                 UI.WriteLine("{0} no tiene dinero suficiente.", player);
             }
             else
             {
                 player.BuyRailroad(this);
                 UI.WriteLine("{0} compró {1}.", player, this);
             }
         }
     }
     else if (Owner == player)
     {
         UI.WriteLine("{0} es el dueño de {1}. Fin del turno.", player, this);
     }
     else
     {
         UI.WriteLine("{0} es propiedad de {1}. El costo del pasaje es ${2}.", this, Owner, TicketCost);
         if (player.Money > TicketCost)
         {
             player.Money -= TicketCost;
             Owner.Money  += TicketCost;
             UI.WriteLine("{0} ha pagado ${1} a {2}.", player, TicketCost, Owner);
         }
         else
         {
             player.Lose();
             UI.WriteLine("{0} no tiene dinero suficiente y ha quedado fuera del juego.", player);
         }
     }
 }
示例#5
0
 public override void ReceivePlayer(Player player)
 {
     if (Owner == null)
     {
         UI.WriteLine("{0} no tiene dueño.", this);
         if (UI.ChooseBoolean("¿Desea comprarla? (s: sí, N: no)"))
         {
             if (player.Money < Price)
             {
                 UI.WriteLine("{0} no tiene dinero suficiente.", player);
             }
             else
             {
                 player.BuyProperty(this);
                 UI.WriteLine("{0} compró {1}.", player, this);
             }
         }
     }
     else if (Owner == player)
     {
         UI.WriteLine("{0} es el dueño de {1}. Fin del turno.", player, this);
     }
     else
     {
         UI.WriteLine("{0} es propiedad de {1}. El alquiler es ${2}.", this, Owner, Rent);
         if (player.Money > Rent)
         {
             player.Money -= Rent;
             Owner.Money  += Rent;
             UI.WriteLine("{0} ha pagado ${1} a {2}.", player, Rent, Owner);
         }
         else
         {
             player.Lose();
             UI.WriteLine("{0} no tiene dinero suficiente y ha quedado fuera de juego.", player);
         }
     }
 }
示例#6
0
 public override void ReceivePlayer(Player player)
 {
     player.Money += 200;
     UI.WriteLine("Se pagaron $200 a {0}", player);
 }