private Random rnd = new Random(); //make one instance of random to ensure random is not shared among all 4 dog #endregion Fields #region Constructors //workflow goes here... public x() { InitializeComponent(); Gambler joe = new Gambler("Joe", RadioJoe, Joe_Bet_Label); Gambler ringo = new Gambler("Ringo", Radio_Ringo, Ringo_Bet_Label); Gambler alex = new Gambler("Alex", Radio_Alex, Alex_Bet_Label); GreyHound Adog = new GreyHound("A DOG", Dog1, pictureBox1, Testing); GreyHound Bdog = new GreyHound("B DOG", Dog2, pictureBox1, Testing); GreyHound Cdog = new GreyHound("C DOG", Dog3, pictureBox1, Testing); GreyHound Ddog = new GreyHound("D DOG", Dog4, pictureBox1, Testing); gambler_list = new List<Gambler> { joe, alex, ringo }; dog_list = new GreyHound[] { Adog, Bdog, Cdog, Ddog }; }
public void PlaceBet(TrackBar trackBar, NumericUpDown numericUp, GreyHound[] dog_list) { MyBet = new Bet(); MyBet.player = this; MyBet.dog = dog_list[((int) numericUp.Value)-1]; MyBet.amount = trackBar.Value; cash -= MyBet.amount; UpdateLabels(); }