Exemple #1
0
        public Form1()
        {
            InitializeComponent();

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

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

            minimumBetLabel.Text = "Minimum Bet: " + betAmountLabel.Minimum + " bucks";
        }
Exemple #2
0
        private void frmRaceTrackSim_Load(object sender, EventArgs e)
        {
            lblMinBet.Text = lblMinBet.Text + " " + nudBetAmt.Minimum.ToString() + " bucks";

            guys[0] = new Guy()
            {
                Name = "Joe", MyBet = null, Cash = 50, MyRadioButton = rdoJoe, MyLabel = lblJoeBet
            };
            guys[1] = new Guy()
            {
                Name = "Bob", MyBet = null, Cash = 75, MyRadioButton = rdoBob, MyLabel = lblBobBet
            };
            guys[2] = new Guy()
            {
                Name = "Al", MyBet = null, Cash = 45, MyRadioButton = rdoAl, MyLabel = lblAlBet
            };

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

            dogs[0] = new Greyhound()
            {
                StartingPosition = pbDog1.Location.X, RacetrackLength = pbRacetrack.Width, MyPictureBox = pbDog1, Location = 1, Randomizer = new Random()
            };
            dogs[1] = new Greyhound()
            {
                StartingPosition = pbDog2.Location.X, RacetrackLength = pbRacetrack.Width, MyPictureBox = pbDog2, Location = 2, Randomizer = new Random()
            };
            dogs[2] = new Greyhound()
            {
                StartingPosition = pbDog3.Location.X, RacetrackLength = pbRacetrack.Width, MyPictureBox = pbDog3, Location = 3, Randomizer = new Random()
            };
            dogs[3] = new Greyhound()
            {
                StartingPosition = pbDog4.Location.X, RacetrackLength = pbRacetrack.Width, MyPictureBox = pbDog4, Location = 4, Randomizer = new Random()
            };
        }
Exemple #3
0
        public Form1()
        {
            InitializeComponent();

            racers = new Greyhound[4];
            bettors = new Guy[3];

            racers[0] = new Greyhound()
            {
                MyPictureBox = pictureBox1,
                StartingPosition = pictureBox1.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox1.Width,
                Randomizer = MyRandomizer
            };

            racers[1] = new Greyhound()
            {
                MyPictureBox = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox2.Width,
                Randomizer = MyRandomizer
            };

            racers[2] = new Greyhound()
            {
                MyPictureBox = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox3.Width,
                Randomizer = MyRandomizer
            };

            racers[3] = new Greyhound()
            {
                MyPictureBox = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RacetrackLength = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer = MyRandomizer
            };

            bettors[0] = new Guy()
            {
                Name = "Joe",
                Cash = 100,
                MyLabel = joeLabel,
                MyRadioButton = joeRadioButton,
                MyBet = null
            };

            bettors[1] = new Guy()
            {
                Name = "Bob",
                Cash = 100,
                MyLabel = bobLabel,
                MyRadioButton = bobRadioButton,
                MyBet = null
            };

            bettors[2] = new Guy()
            {
                Name = "Al",
                Cash = 100,
                MyLabel = alLabel,
                MyRadioButton = alRadioButton,
                MyBet = null
            };

            for(int i = 0; i < bettors.Length; i++)
            {
                bettors[i].ClearBet();
                bettors[i].UpdateLabels();
            }
        }
        public Form1()
        {
            InitializeComponent();
            MyRandomizer      = new Random();
            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
            };

            guy[0] = new Guy()
            {
                Name          = "Joe",
                MyLabel       = joeBetLabel,
                MyRadioButton = joeRadioButton,
                Cash          = 50,
                MyBet         = null
            };
            guy[0].UpdateLabels();
            guy[1] = new Guy()
            {
                Name          = "Bob",
                MyLabel       = bobBetLabel,
                MyRadioButton = bobRadioButton,
                Cash          = 75,
                MyBet         = null
            };
            guy[1].UpdateLabels();
            guy[2] = new Guy()
            {
                Name          = "Al",
                MyLabel       = alBetLabel,
                MyRadioButton = alRadioButton,
                Cash          = 45,
                MyBet         = null
            };
            guy[2].UpdateLabels();
        }
        public Form1()
        {
            InitializeComponent();

            //Initialize all the dog objects
            Dogs[0] = new Greyhound()
            {
                MyPictureBox     = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RacetrackLength  = pictureBox1.Width - pictureBox2.Width,
                Randomizer       = myRandom
            };
            Dogs[1] = new Greyhound()
            {
                MyPictureBox     = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RacetrackLength  = pictureBox1.Width - pictureBox3.Width,
                Randomizer       = myRandom
            };
            Dogs[2] = new Greyhound()
            {
                MyPictureBox     = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RacetrackLength  = pictureBox1.Width - pictureBox4.Width,
                Randomizer       = myRandom
            };
            Dogs[3] = new Greyhound()
            {
                MyPictureBox     = pictureBox5,
                StartingPosition = pictureBox5.Left,
                RacetrackLength  = pictureBox1.Width - pictureBox5.Width,
                Randomizer       = myRandom
            };

            //Initialize all the guy objects
            guys[0] = new Guy()
            {
                Cash          = 50,
                MyBet         = null,
                MyLabel       = joeBetLabel,
                MyRadioButton = joeRadioButton,
                Name          = "Joe"
            };
            guys[1] = new Guy()
            {
                Cash          = 75,
                MyBet         = null,
                MyLabel       = bobBetLabel,
                MyRadioButton = bobRadioButton,
                Name          = "Bob"
            };
            guys[2] = new Guy()
            {
                Cash          = 45,
                MyBet         = null,
                MyLabel       = alBetLabel,
                MyRadioButton = alRadioButton,
                Name          = "Al"
            };

            //Set the labels
            foreach (Guy guy in guys)
            {
                guy.MyBet = new Bet();
                guy.ClearBet();
                guy.UpdateLabels();
            }

            minimumBetLabel.Text = $@"Minimum bet is ${BetAmount.Minimum}";
        }