Exemple #1
0
 public void InitGreyhounds()
 {
     GreyhoundArray[0] = new Greyhound()
     {
         StartingPosition = pictureBoxDog1.Left,
         RacetrackLength = racetrackPictureBox.Width - pictureBoxDog1.Width,
         MyPictureBox = pictureBoxDog1,
         Randomizer = MyRandomizer
     };
     GreyhoundArray[1] = new Greyhound()
     {
         StartingPosition = pictureBoxDog2.Left,
         RacetrackLength = racetrackPictureBox.Width - pictureBoxDog2.Width,
         MyPictureBox = pictureBoxDog2,
         Randomizer = MyRandomizer
     };
     GreyhoundArray[2] = new Greyhound()
     {
         StartingPosition = pictureBoxDog3.Left,
         RacetrackLength = racetrackPictureBox.Width - pictureBoxDog3.Width,
         MyPictureBox = pictureBoxDog3,
         Randomizer = MyRandomizer
     };
     GreyhoundArray[3] = new Greyhound()
     {
         StartingPosition = pictureBoxDog4.Left,
         RacetrackLength = racetrackPictureBox.Width - pictureBoxDog4.Width,
         MyPictureBox = pictureBoxDog4,
         Randomizer = MyRandomizer
     };
 }
Exemple #2
0
 private void houndsStart(Greyhound[] hounds)
 {
     foreach (Greyhound hound in hounds)
     {
         hound.TakeStartingPosition();
     }
 }
        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();
            }
        }
Exemple #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);
 }
        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
            };
        }
Exemple #6
0
 public bool PlaceBet(int Amount, Greyhound Dog)
 {
     //check to see if we have enough cash first
     if (Amount <= Cash)
     {
         //create the bet, assign the amount, dog and who placed the bet. Finish up by updating labels
         MyBet = new Bet();
         MyBet.Amount = Amount;
         MyBet.Dog = Dog;
         MyBet.Bettor = this;
         UpdateLabels();
         return (true);
     }
     else
     {
         //sorry, you are broke
         return (false);
     }
 }
Exemple #7
0
        public Form1()
        {
            InitializeComponent();

            GreyhoundArray[0] = new Greyhound()
            {
                GreyhoundPictureBox = pictureBox1, StartingPosition = pictureBox1.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox1.Width, Randomizer = MyRandomizer
            };
            GreyhoundArray[1] = new Greyhound()
            {
                GreyhoundPictureBox = pictureBox2, StartingPosition = pictureBox2.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox2.Width, Randomizer = MyRandomizer
            };
            GreyhoundArray[2] = new Greyhound()
            {
                GreyhoundPictureBox = pictureBox3, StartingPosition = pictureBox3.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox3.Width, Randomizer = MyRandomizer
            };
            GreyhoundArray[3] = new Greyhound()
            {
                GreyhoundPictureBox = pictureBox4, StartingPosition = pictureBox4.Left, RacetrackLength = racetrackPictureBox.Width - pictureBox4.Width, Randomizer = MyRandomizer
            };

            GuyArray[0] = new Guy()
            {
                Name = "Joe", Cash = 50, MyRadioButton = joeRadioButton, MyLabel = joeBetLabel
            };
            GuyArray[1] = new Guy()
            {
                Name = "Bob", Cash = 75, MyRadioButton = bobRadioButton, MyLabel = bobBetLabel
            };
            GuyArray[2] = new Guy()
            {
                Name = "Al", Cash = 45, MyRadioButton = alRadioButton, MyLabel = alBetLabel
            };

            for (int i = 0; i < 3; i++)
            {
                GuyArray[i].ClearBet();
                GuyArray[i].UpdateLabels();
            }
        }
Exemple #8
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);
 }
Exemple #9
0
 public void Collect(Greyhound Winner)
 {
     //did you place a bet? if so check to see if you won or lost
     if (MyBet != null)
         Cash += MyBet.PayOut(Winner);
 }
Exemple #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";
        }
Exemple #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;
        }
Exemple #12
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;
        }
Exemple #13
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";
        }
Exemple #14
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();
            }
        }