// Generate a 75 Ball Standard Bingo Ball Set public void PopulateStandardBingoBallSet() { for (int i = 1; i < 16; i++) { Ball b = new Ball('B', i, Color.Blue); _balls.Add(b); BallSetSize = _balls.Count; } for (int i = 16; i < 31; i++) { Ball b = new Ball('I', i, Color.Indigo); _balls.Add(b); BallSetSize = _balls.Count; } for (int i = 31; i < 46; i++) { Ball b = new Ball('N', i, Color.Red); _balls.Add(b); BallSetSize = _balls.Count; } for (int i = 46; i < 61; i++) { Ball b = new Ball('G', i, Color.Green); _balls.Add(b); BallSetSize = _balls.Count; } for (int i = 61; i < 76; i++) { Ball b = new Ball('O', i, Color.Orange); _balls.Add(b); BallSetSize = _balls.Count; } }
// Member Methods // public Ball PopBall() { var nullBall = new Ball(); if (PoppersCapacity <= 0) return nullBall; if (BingoBallSet.BallSetSize <= 0) return nullBall; var randomNumGenerator = new Random(); var randomBall = randomNumGenerator.Next(BingoBallSet.BallSetSize); _poppedBall = BingoBallSet.RemoveBall(randomBall); return _poppedBall; }
// Overloaded Constructor public SuperBallPopper(int popperMaxCapacity) { BingoBallSet = new BallSet(); _poppedBall = new Ball(); PoppersCapacity = popperMaxCapacity; // Num of Balls for a Standard Game if (PoppersCapacity == 75) { BingoBallSet.PopulateStandardBingoBallSet(); BingoBallSet.SetName = ("Standard Bingo Game Popper Created with " + BingoBallSet.BallSetSize + " balls.\n"); } else // MaxCapacity !75 { for (var i = 1; i < popperMaxCapacity; i++) { var b = new Ball(i); BingoBallSet.AddBall(b); } BingoBallSet.SetName = ("Custom Bingo Game Popper Created with " + BingoBallSet.BallSetSize + " balls\n"); } }
public void AddBall(Ball b) { _balls.Add(b); BallSetSize = _balls.Count; }
// Constructors public SuperBallPopper() { BingoBallSet = new BallSet(); _poppedBall = new Ball(); PoppersCapacity = 0; }