Exemplo n.º 1
0
        private Corredor BuscarGanador()
        {
            var aux = new Corredor();

            for (int i = 0; i < corredores.Count; i++)
            {
                if (i == 0)
                {
                    aux = corredores[i];
                }

                if (aux.Tiempo > corredores[i].Tiempo)
                {
                    aux = corredores[i];
                }
            }

            return(aux);
        }
Exemplo n.º 2
0
        public string _Aavanzar()
        {
            Corredor t = new Corredor();
            int      r;
            int      avanzar  = 0;
            int      posicion = 0;
            string   muestra  = "";

            while (posicion <= 80)
            {
                r = t.Avanzar();
                if (r >= 1 && r <= 5)
                {
                    avanzar = avanzar + 3;
                }
                else
                {
                    if (r >= 6 && r <= 7)
                    {
                        if (avanzar <= 6)
                        {
                            avanzar = 0;
                        }
                        else
                        {
                            avanzar = avanzar - 6;
                        }
                    }
                    else
                    {
                        if (r >= 8 && r <= 10)
                        {
                            avanzar = avanzar + 1;
                        }
                    }
                }
                posicion = posicion + avanzar;
                muestra += "La tortuga se encuentra en la posicion: " + posicion + "m" + Environment.NewLine;
            }
            return(muestra);
        }
Exemplo n.º 3
0
        public void IniciarCarrera()
        {
            var aux = new Corredor();

            foreach (var e in etapas)
            {
                Console.WriteLine("Esta es la etapa {0} con un kilometraje de {1}", e.FechaEtapa.ToShortDateString(), e.KmEtapa);

                foreach (var c in Corredores)
                {
                    c.LimpiarTiempo();
                    Console.WriteLine("Ingrese tiempo {0} ", c.Nombre);
                    c.TiempoCarrera = float.Parse(Console.ReadLine());

                    c.CalcularPromedio(float.Parse(e.KmEtapa));
                }

                aux.OrdenarPorTiempo(Corredores);

                foreach (var eq in Equipos)
                {
                    float tiempo = 0;
                    int   cant   = 0;

                    foreach (var c in Corredores)
                    {
                        if (eq.Nombre == c.RefEquipo.Nombre)
                        {
                            tiempo += c.TiempoCarrera;
                            cant++;
                        }
                    }

                    eq.CalcularTiempo(tiempo, cant);
                }

                MostrarDatos();
            }
        }
Exemplo n.º 4
0
 public void AñadirCorredor(Corredor corredor)
 {
     Corredores.Add(corredor);
 }