Ejemplo n.º 1
0
 public bool PlaceBet(int Amount, int Dog)
 {
     if (Amount <= Cash) {
         MyBet = new Bet(Amount, Dog, this);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public Guy(string Name, Bet MyBet, int Cash, RadioButton MyRadioButton, Label MyLabel)
 {
     this.Name = Name;
     this.MyBet = MyBet;
     this.Cash = Cash;
     this.MyRadioButton = MyRadioButton;
     this.MyLabel = MyLabel;
 }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button2.Enabled = false;
            Bet myBet = new Bet();

            // if (!dogs[0].run() || !dogs[1].run() || !dogs[2].run() || !dogs[3].run()) return;
            // else
            // {

            dogs[0].takeStartingPosition(27);
            dogs[1].takeStartingPosition(27);
            dogs[2].takeStartingPosition(27);
            dogs[3].takeStartingPosition(27);
            label9.Text = "All bets: double-or-nothing";

            //change the picture boxes to animated gif images

            pictureBox2.Enabled    = true;
            pictureBox3.Enabled    = true;
            pictureBox4.Enabled    = true;
            pictureBox5.Enabled    = true;
            this.pictureBox2.Image = global::RaceTrackSimulator.Properties.Resources.ezgif_com_rotate;
            this.pictureBox3.Image = global::RaceTrackSimulator.Properties.Resources.ezgif_com_rotate_1;
            this.pictureBox4.Image = global::RaceTrackSimulator.Properties.Resources.ezgif_com_rotate_2;
            this.pictureBox5.Image = global::RaceTrackSimulator.Properties.Resources.ezgif_com_crop3;


            while (!dogs[0].run() && !dogs[1].run() && !dogs[2].run() && !dogs[3].run())
            {
                // for (int c = 0; c <= dogs[0].racetrackLength; c++)
                // {
                Application.DoEvents();
                System.Threading.Thread.Sleep(1);
                // if (dogs[0].location < dogs[0].racetrackLength)
                dogs[0].run();
                // if (dogs[1].location < dogs[1].racetrackLength)
                dogs[1].run();
                // if (dogs[2].location < dogs[2].racetrackLength)
                dogs[2].run();
                // if (dogs[3].location < dogs[3].racetrackLength)
                dogs[3].run();
                // }
            }

            /* change the images on the picture boxes to a static one as a dog wins*/
            pictureBox2.Enabled = false;
            pictureBox3.Enabled = false;
            pictureBox4.Enabled = false;
            pictureBox5.Enabled = false;

            int winner = 0;

            if (dogs[0].run())
            {
                winner = 1;
            }
            if (dogs[1].run())
            {
                winner = 2;
            }
            if (dogs[2].run())
            {
                winner = 3;
            }
            if (dogs[3].run())
            {
                winner = 4;
            }

            label9.Text = "We have a Winner!!! \n Dog #" + winner + " Wins! ";
            if (players[0].myBet != null)
            {
                players[0].collect(winner);
                players[0].updateLabels();
            }
            if (players[1].myBet != null)
            {
                players[1].collect(winner);
                players[1].updateLabels();
            }
            if (players[2].myBet != null)
            {
                players[2].collect(winner);
                players[2].updateLabels();
            }
            button1.Enabled = true;
            button2.Enabled = true;
            // }
        }
Ejemplo n.º 4
0
 public void clearBet()
 {
     // Reset my bet so it is zero
     myBet = null;
     updateLabels();
 }