Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            txtResultado.ScrollBars = ScrollBars.Vertical;
            Corredor liebre  = new Liebre();
            Corredor tortuga = new Tortuga();

            while (tortuga.Avance < 80 && liebre.Avance < 80)
            {
                tortuga.Avanzando(); liebre.Avanzando();
                txtResultado.Text += "Tortuga {" + tortuga.Avance + "} \r\n" + "Liebre {" + liebre.Avance + "} \r\n";
            }

            if (tortuga.Avance >= 80 && liebre.Avance >= 80)
            {
                txtResultado.Text += "Empate\r\n";
            }
            else if (tortuga.Avance > liebre.Avance)
            {
                txtResultado.Text += "Gano la tortuga\r\n";
            }
            else
            {
                txtResultado.Text += "Gano la liebre\r\n";
            }
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();

            l = new Liebre();
            t = new Tortuga();
        }