예제 #1
0
        public Form1()
        {
            InitializeComponent();

            dogs[0] = new Greyhound()
            {
                MyPictureBox = dog1,
                Randomizer = distance,
                numOfDog = 1,
            };
            dogs[1] = new Greyhound()
            {
                MyPictureBox = dog2,
                Randomizer = distance,
                numOfDog = 2,
            };
            dogs[2] = new Greyhound()
            {
                MyPictureBox = dog3,
                Randomizer = distance,
                numOfDog = 3,
            };
            dogs[3] = new Greyhound()
            {
                MyPictureBox = dog4,
                Randomizer = distance,
                numOfDog = 4,
            };

            guys[0] = new Guy()
            {
                MyRadioButton = radioButton1,
                MyLabel = joesBet,
                Name = "Joe",
                Cash = 6,
            };
            guys[1] = new Guy()
            {
                MyRadioButton = radioButton2,
                MyLabel = bobsBet,
                Name = "Bob",
                Cash = 75
            };
            guys[2] = new Guy()
            {
                MyRadioButton = radioButton3,
                MyLabel = aisBet,
                Name = "AI",
                Cash = 45,
            };

            label1.Text = "Minimum bet: " + (int)amount.Minimum + " bucks";
            radioButton1.Text = guys[0].Name + " has " + guys[0].Cash + " bucks";
            radioButton2.Text = guys[1].Name + " has " + guys[1].Cash + " bucks";
            radioButton3.Text = guys[2].Name + " has " + guys[2].Cash + " bucks";
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            guyArray[0] = new Guy() { Name = "Joe", Cash = 100, MyRadioButton = joeButton };
            guyArray[1] = new Guy() { Name = "Bob", Cash = 100, MyRadioButton = BobButton };
            guyArray[2] = new Guy() { Name = "Al", Cash = 100, MyRadioButton = alButton };

            //Guy Joe = guyArray[0];
            //Guy Bob = guyArray[1];
            //Guy Al = guyArray[2];

            greyArray[0] = new Greyhound() { StartingPosition = 0, RacetrackLength = RaceTrack.Image.Width, MyPictureBox = GreyHoundPicutre1, Location = 0 };
            greyArray[1] = new Greyhound() { StartingPosition = 0, RacetrackLength = RaceTrack.Image.Width, MyPictureBox = GreyHoundPicutre2, Location = 0 };
            greyArray[2] = new Greyhound() { StartingPosition = 0, RacetrackLength = RaceTrack.Image.Width, MyPictureBox = GreyHoundPicutre3, Location = 0 };
            greyArray[3] = new Greyhound() { StartingPosition = 0, RacetrackLength = RaceTrack.Image.Width, MyPictureBox = GreyHoundPicutre4, Location = 0 };
        }
예제 #3
0
        public Form1()
        {
            InitializeComponent();

            dogs[0] = new Greyhound()
            {
                MyPictureBox = greyHound1,
                StartingPosition = greyHound1.Left,
                RacetrackLength = raceTrack.Width - greyHound1.Width,
                Randomizer = MyRandomizer
            };

            dogs[1] = new Greyhound()
            {
                MyPictureBox = greyHound2,
                StartingPosition = greyHound2.Left,
                RacetrackLength = raceTrack.Width - greyHound2.Width,
                Randomizer = MyRandomizer
            };

            dogs[2] = new Greyhound()
            {
                MyPictureBox = greyHound3,
                StartingPosition = greyHound3.Left,
                RacetrackLength = raceTrack.Width - greyHound3.Width,
                Randomizer = MyRandomizer
            };

            dogs[3] = new Greyhound()
            {
                MyPictureBox = greyHound4,
                StartingPosition = greyHound4.Left,
                RacetrackLength = raceTrack.Width - greyHound4.Width,
                Randomizer = MyRandomizer
            };

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

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

            guys[2] = new Guy()
            {
                MyLabel = alBetLabel,
                Name = "Al",
                Cash = 45,
                MyBet = new Bet(),
                MyRadioButton = alRadioButton
            };
        }
예제 #4
0
        public Form1()
        {
            InitializeComponent();
            GreyhoundArray[0] = new Greyhound()
            {
                MyPictureBox        = pictureBox1,
                StartingPosition    = 0,
                RacetrackPictureBox = racetrackPictureBox,
                RacetrackLength     = racetrackPictureBox.Width - pictureBox1.Width,
                Randomizer          = MyRandomizer
            };
            GreyhoundArray[1] = new Greyhound()
            {
                MyPictureBox        = pictureBox2,
                RacetrackPictureBox = racetrackPictureBox,
                RacetrackLength     = racetrackPictureBox.Width - pictureBox2.Width,
                Randomizer          = MyRandomizer
            };
            GreyhoundArray[2] = new Greyhound()
            {
                MyPictureBox        = pictureBox3,
                RacetrackPictureBox = racetrackPictureBox,
                RacetrackLength     = racetrackPictureBox.Width - pictureBox3.Width,
                Randomizer          = MyRandomizer
            };
            GreyhoundArray[3] = new Greyhound()
            {
                MyPictureBox        = pictureBox4,
                RacetrackPictureBox = racetrackPictureBox,
                RacetrackLength     = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer          = MyRandomizer
            };

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

            GuyArray[0].MyBet = new Bet()
            {
                Bettor = GuyArray[0],
                Amount = 0,
                Dog    = (int)dogNumber.Value
            };

            GuyArray[1] = new Guy()
            {
                Name          = "Bob",
                Cash          = 75,
                MyLabel       = bobBetLabel,
                MyRadioButton = bobRadioButton
            };
            GuyArray[1].MyBet = new Bet()
            {
                Bettor = GuyArray[1],
                Amount = 0,
                Dog    = (int)dogNumber.Value
            };
            GuyArray[2] = new Guy()
            {
                Name          = "Al",
                Cash          = 45,
                MyLabel       = alBetLabel,
                MyRadioButton = alRadioButton
            };
            GuyArray[2].MyBet = new Bet()
            {
                Bettor = GuyArray[2],
                Amount = 0,
                Dog    = (int)dogNumber.Value
            };
        }
예제 #5
0
파일: Form1.cs 프로젝트: dotts-h/Self-Study
        public Form1()
        {
            InitializeComponent();

            guys[0] = new Guy()
            {
                Name          = "Joe",
                Cash          = 50,
                MyRadioButton = joeRadioButton,
                MyLabel       = joeLabel
            };
            guys[0].PlaceBet(0, 0);
            guys[0].UpdateLabels();
            guys[1] = new Guy()
            {
                Name          = "Bob",
                Cash          = 75,
                MyRadioButton = bobRadioButton,
                MyLabel       = bobLabel
            };
            guys[1].PlaceBet(0, 0);
            guys[1].UpdateLabels();
            guys[2] = new Guy()
            {
                Name          = "Al",
                Cash          = 45,
                MyRadioButton = alRadioButton,
                MyLabel       = alLabel
            };
            guys[2].PlaceBet(0, 0);
            guys[2].UpdateLabels();

            dogs[0] = new Greyhound()
            {
                StartingPosition = dog1PictureBox.Location.X,
                MyPictureBox     = dog1PictureBox,
                RacetrackLength  = dog1PictureBox.Location.X + raceTrackPictureBox.Width
            };
            dogs[1] = new Greyhound()
            {
                StartingPosition = dog2PictureBox.Location.X,
                MyPictureBox     = dog2PictureBox,
                RacetrackLength  = dog2PictureBox.Location.X + raceTrackPictureBox.Width
            };
            dogs[2] = new Greyhound()
            {
                StartingPosition = dog3PictureBox.Location.X,
                MyPictureBox     = dog3PictureBox,
                RacetrackLength  = dog3PictureBox.Location.X + raceTrackPictureBox.Width
            };
            dogs[3] = new Greyhound()
            {
                StartingPosition = dog4PictureBox.Location.X,
                MyPictureBox     = dog4PictureBox,
                RacetrackLength  = dog4PictureBox.Location.X + raceTrackPictureBox.Width
            };
            //dogs[0].RacetrackLength = raceTrackPictureBox.ImageLocation.Length;
            //dogs[1].RacetrackLength = raceTrackPictureBox.ImageLocation.Length;
            //dogs[2].RacetrackLength = raceTrackPictureBox.ImageLocation.Length;
            //dogs[3].RacetrackLength = raceTrackPictureBox.ImageLocation.Length;

            minLabel.Text = "Minimum bet: " + betsNumericUD.Minimum + " bucks";
            minLabel.Update();
        }