Пример #1
0
 public void InitGuys()
 {
     Guys[0] = new Guy() {
         Name = "Joe",
         Cash = 50,
         MyRadioButton = radioButtonJoe,
         MyLabel = labelBetJoe
     };
     Guys[1] = new Guy()
     {
         Name = "Bob",
         Cash = 75,
         MyRadioButton = radioButtonBob,
         MyLabel = labelBetBob
     };
     Guys[2] = new Guy()
     {
         Name = "Al",
         Cash = 45,
         MyRadioButton = radioButtonAl,
         MyLabel = labelBetAl
     };
     foreach(Guy g in Guys)
     {
         g.UpdateLabels();
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            minimum_bet.Text = string.Format("{0:c}", (int)bet_amount.Minimum);
            int start_position = track.Left;
            int track_length = track.Size.Width;
            PictureBox[] images = new PictureBox[4] {dog_0, dog_1, dog_2, dog_3};
            Random randomizer = new Random();

            for (int i = 0; i < dogs.Length; i++)
            {
                dogs[i] = new Greyhound()
                {
                    image = images[i],
                    track_length = track_length,
                    starting_position = start_position,
                    randomizer = randomizer
                };
            }

            guys[0] = new Guy("Joe", null, 50, button_joe, betLabel_joe);
            guys[1] = new Guy("Bob", null, 75, button_bob, betLabel_bob);
            guys[2] = new Guy("Al", null, 45, button_al, betLabel_al);

            foreach (Guy guy in guys)
            {
                guy.updateLabels();
            }
        }
Пример #3
0
 private void noBets(Guy[] guys)
 {
     foreach (Guy guy in guys)
     {
         guy.ClearBet();
         guy.UpdateLabel();
     }
 }
Пример #4
0
 public Form1()
 {
     InitializeComponent();
     //Initialize Guy objects
     guyArray[0] = new Guy("Joe", joeRadioButton, 50, joeBetLabel);
     guyArray[1] = new Guy("Bob", bobRadioButton, 75, bobBetLabel);
     guyArray[2] = new Guy("Al", alRadioButton, 45, alBetLabel);
     //Initialize Geyhound objects
     greyhoundArray[0] = new Greyhound(Dog1PictureBox, Randomizer);
     greyhoundArray[1] = new Greyhound(Dog2PictureBox, Randomizer);
     greyhoundArray[2] = new Greyhound(Dog3PictureBox, Randomizer);
     greyhoundArray[3] = new Greyhound(Dog4PictureBox, Randomizer);
 }
Пример #5
0
        public Form1()
        {
            InitializeComponent();
            //bool HasRaceStarted = false;

            GuyArray[0] = joe = new Guy() { Name = "Joe", Cash = 50, MyRadioButton = rbJoeRadioButton,MyLabel=lblJoeBetLabel, MyBet = null};
            GuyArray[1] = bob = new Guy() { Name = "Bob", Cash = 75, MyRadioButton = rbBobRadioButton, MyLabel = lblBobBetLabel, MyBet = null };
            GuyArray[2] = al = new Guy() { Name = "Al", Cash = 45, MyRadioButton = rbAlRadioButton, MyLabel = lblAlBetLabel, MyBet = null };
            for (int i = 0; i < GuyArray.Length; i++)
            {
                GuyArray[i].ClearBet();
            }

            UpdateLabels();

            GreyhoundArray[0] = new Greyhound()
            {
                MyPictureBox = pbDogNumber1,
                StartingPosition = pbDogNumber1.Left,
                RacetrackLength = pbRacetrack.Width - pbDogNumber1.Width,
                Randomizer = MyRandomizer
            };
            GreyhoundArray[1] = new Greyhound()
            {
                MyPictureBox = pbDogNumber2,
                StartingPosition = pbDogNumber2.Left,
                RacetrackLength = pbRacetrack.Width - pbDogNumber2.Width,
                Randomizer = MyRandomizer
            };
            GreyhoundArray[2] = new Greyhound()
            {
                MyPictureBox = pbDogNumber3,
                StartingPosition = pbDogNumber3.Left,
                RacetrackLength = pbRacetrack.Width - pbDogNumber3.Width,
                Randomizer = MyRandomizer
            };
            GreyhoundArray[3] = new Greyhound()
            {
                MyPictureBox = pbDogNumber4,
                StartingPosition = pbDogNumber4.Left,
                RacetrackLength = pbRacetrack.Width - pbDogNumber4.Width,
                Randomizer = MyRandomizer
            };
        }
Пример #6
0
 public Form1()
 {
     InitializeComponent();
     Guy joe = new Guy() { Name = "Joe", Money = 50, MyRadioButton = joesRadioB, MyLabel = joeBetLabel };
     Guy john = new Guy() { Name = "John", Money = 45, MyRadioButton = johnRadioB, MyLabel = johnBetLabel };
     Guy bob = new Guy() { Name = "Bob", Money = 75, MyRadioButton = bobRadioB, MyLabel = bobBetLabel };
     minimumBetLabel.Text = "Minimum bet: " + betPicker.Minimum + " bucks";
     guys[0] = joe;
     guys[1] = bob;
     guys[2] = john;
     for (int i = 0; i < hounds.Length;i++ )
     {
         if (hounds[i] == null)
         {
             hounds[i] = new Greyhound() { StartingPosition = dog1.Left, RaceTrackLength = raceTrack.Width,randomizer=myRnd };
         }
     }
     hounds[0].MyPictureBox = dog1;
     hounds[1].MyPictureBox = dog2;
     hounds[2].MyPictureBox = dog3;
     hounds[3].MyPictureBox = dog4;
     houndsStart(hounds);
     noBets(guys);
 }
Пример #7
0
 public Bet(int anAmount, int aDog, Guy aGuy)
 {
     Amount = anAmount;
     Dog = aDog;
     Bettor = aGuy;
 }
Пример #8
0
 public Bet(int amount, int dog, Guy bettor)
 {
     this.amount = amount;
     this.dog = dog;
     this.bettor = bettor;
 }
Пример #9
0
 private void placeBetForGuy(Guy dude, int p, int dog)
 {
     dude.MyBet.Amount = p;
     dude.MyBet.Dog = dog;
     dude.UpdateLabel();
 }
Пример #10
0
        public Form1()
        {
            InitializeComponent();

            //fill array
            radioSelections[0] = radioButton1;
            radioSelections[1] = radioButton2;
            radioSelections[2] = radioButton3;

            //create the guys
            Girls[0] = new Guy(){	Name = "Hannah",
                                    MyLabel = betsLabel1,
                                    MyRadioButton = radioButton1,
                                    Cash = 50};
            Girls[1] = new Guy(){	Name = "Elissa",
                                    MyLabel = betsLabel2,
                                    MyRadioButton = radioButton2,
                                    Cash = 75};
            Girls[2] = new Guy(){	Name = "Teagan",
                                    MyLabel = betsLabel3,
                                    MyRadioButton = radioButton3,
                                    Cash = 45};

            //and initialise their labels
            foreach (Guy g in Girls)	{
                g.UpdateLabels();
            }

            //create the dogs, my kids insisted I give them names
            Dogs[0] = new Greyhound(){	Name = "Skipper",
                                        MyPictureBox = dogPictureBox1,
                                        Randomizer = myRandom,
                                        StartingPosition = 20,
                                        RacetrackLength = 480};
            Dogs[1] = new Greyhound(){	Name = "Prancer",
                                        MyPictureBox = dogPictureBox2,
                                        Randomizer = myRandom,
                                        StartingPosition = 20,
                                        RacetrackLength = 480};
            Dogs[2] = new Greyhound(){	Name = "Stinker",
                                        MyPictureBox = dogPictureBox3,
                                        Randomizer = myRandom,
                                        StartingPosition = 20,
                                        RacetrackLength = 480};
            Dogs[3] = new Greyhound(){	Name = "Speedy Gonzalez",
                                        MyPictureBox = dogPictureBox4,
                                        Randomizer = myRandom,
                                        StartingPosition = 20,
                                        RacetrackLength = 480};

            //add each dog to the combo box
            foreach(Greyhound g in Dogs)
            {
                comboBox1.Items.Add(g.Name);
            }
            comboBox1.SelectedIndex = 0;	//default select the first dog

            //set minimum bet to a value of 5 and update label
            betAmount.Minimum = 5;
            minimumBet.Text = "Minimum bet: " + betAmount.Minimum + " bucks";
        }
Пример #11
0
        public Form1()
        {
            InitializeComponent();

            MyRandomizer = new Random();

            GreyhoundArray = new Greyhound[4];

            GreyhoundArray[0] = new Greyhound()
            {
                MyPictureBox = pictureBox1,
                StartingPosition = pictureBox1.Left,
                RaceTrackLength = raceTrackPictureBox.Width - pictureBox1.Width,
                Randomizer = MyRandomizer
            };

            GreyhoundArray[1] = new Greyhound()
            {
                MyPictureBox = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RaceTrackLength = raceTrackPictureBox.Width - pictureBox2.Width,
                Randomizer = MyRandomizer
            };

            GreyhoundArray[2] = new Greyhound()
            {
                MyPictureBox = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RaceTrackLength = raceTrackPictureBox.Width - pictureBox3.Width,
                Randomizer = MyRandomizer
            };

            GreyhoundArray[3] = new Greyhound()
            {
                MyPictureBox = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RaceTrackLength = raceTrackPictureBox.Width - pictureBox4.Width,
                Randomizer = MyRandomizer
            };

            GuyArray = new Guy[3];

            GuyArray[0] = new Guy()
                {
                    Name ="Joe",
                    MyRadioButton = joeRadioButton,
                    MyLabel = joeBetLabel,
                    Cash = 50
                };

            GuyArray[1] = new Guy()
                {
                    Name = "Bob",
                    MyRadioButton = bobRadioButton,
                    MyLabel = bobBetLabel,
                    Cash = 75
                };

            GuyArray[2] = new Guy()
                {
                    Name = "Al",
                    MyRadioButton = alRadioButton,
                    MyLabel = alBetLabel,
                    Cash = 45
                };

            for (int i = 0; i < GuyArray.Length; i++)
            {
                GuyArray[i].ClearBet();
                GuyArray[i].UpdateLabels();
            }

            CurrentGuy = GuyArray[0];
            joeRadioButton.Checked = true;

            int minBet = 5;
            betAmount.Minimum = minBet;
            minimumBetLabel.Text = "Minimum bet: " + minBet + " bucks";

            dogNumber.Minimum = 1;
            dogNumber.Maximum = GreyhoundArray.Length;
        }
Пример #12
0
 private void joeRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     if (joeRadioButton.Checked)
     {
         CurrentGuy = GuyArray[0];
         UpdateControls();
     }
 }
Пример #13
0
        private void Setup()
        {
            dogs[0] = new Greyhound
            {
                MyPictureBox     = dog1PictureBox,
                StartingPosition = dog1PictureBox.Left,
                RacetrackLength  = racetrackPictureBox.Width - dog1PictureBox.Width,
                Randomizer       = myRandomizer
            };

            dogs[1] = new Greyhound
            {
                MyPictureBox     = dog2PictureBox,
                StartingPosition = dog2PictureBox.Left,
                RacetrackLength  = racetrackPictureBox.Width - dog2PictureBox.Width,
                Randomizer       = myRandomizer
            };

            dogs[2] = new Greyhound
            {
                MyPictureBox     = dog3PictureBox,
                StartingPosition = dog3PictureBox.Left,
                RacetrackLength  = racetrackPictureBox.Width - dog3PictureBox.Width,
                Randomizer       = myRandomizer
            };

            dogs[3] = new Greyhound
            {
                MyPictureBox     = dog4PictureBox,
                StartingPosition = dog4PictureBox.Left,
                RacetrackLength  = racetrackPictureBox.Width - dog4PictureBox.Width,
                Randomizer       = myRandomizer
            };

            guys[0] = new Guy
            {
                Name          = "Joe",
                Cash          = 50,
                MyBet         = null,
                MyRadioButton = joeRadioButton,
                MyLabel       = joeBetLabel
            };

            guys[1] = new Guy
            {
                Name          = "Bob",
                Cash          = 75,
                MyBet         = null,
                MyRadioButton = bobRadioButton,
                MyLabel       = bobBetLabel
            };

            guys[2] = new Guy
            {
                Name          = "Al",
                Cash          = 45,
                MyBet         = null,
                MyRadioButton = alRadioButton,
                MyLabel       = alBetLabel
            };

            foreach (Guy guy in guys)
            {
                guy.UpdateLabels();
            }
        }