/// <summary> /// this method resets the slot machine /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _resetButton_Click(object sender, EventArgs e) { //reset credits NumberCreditsLabel.Text = "5000"; _credits = 5000; //reset bet BetLabel.Text = "150"; _bet = 150; //reset jackpot JackpotNumberLabel.Text = "10500"; _jackpot = 10500; //reset reel pictures Reel1PictureBox.Load("merry_christmas.png"); Reel2PictureBox.Load("merry_christmas.png"); Reel3PictureBox.Load("merry_christmas.png"); //reset nightmare tallys _shock = 0; _zero = 0; _lock = 0; _barrel = 0; _jack = 0; _sandyClaws = 0; _santa = 0; _oogie = 0; winnings = 0; }
/// <summary> /// this function determines the bet line results and sets the reels to the appropriate image /// </summary> private void _reels() { int[] outCome = { 0, 0, 0 }; string picture = ""; for (var spin = 0; spin < 3; spin++) { outCome[spin] = this.random.Next(65) + 1; if (_checkRange(outCome[spin], 1, 27)) { // 41.5% probability picture = "oogie_boogie.png"; _oogie++; } else if (_checkRange(outCome[spin], 28, 37)) { // 15.4% probability picture = "shock.png"; _shock++; } else if (_checkRange(outCome[spin], 38, 46)) { // 13.8% probability picture = "zero.png"; _zero++; } else if (_checkRange(outCome[spin], 47, 54)) { // 12.3% probability picture = "Lock.png"; _lock++; } else if (_checkRange(outCome[spin], 55, 59)) { // 7.7% probability picture = "barrel.png"; _barrel++; } else if (_checkRange(outCome[spin], 60, 62)) { // 4.6% probability picture = "jack.png"; _jack++; } else if (_checkRange(outCome[spin], 63, 64)) { // 3.1% probability picture = "sandy_claws.png"; _sandyClaws++; } else if (_checkRange(outCome[spin], 65, 65)) { // 1.5% probability picture = "merry_christmas.png"; _santa++; } if (spin == 0) { Reel1PictureBox.Load(picture); } else if (spin == 1) { Reel2PictureBox.Load(picture); } if (spin == 2) { Reel3PictureBox.Load(picture); } } }