public Pick GetWinningPick() { Pick winningBall = FastBalls.QuickPickLickitySplit("Winning Balls"); winningBall.Winnings = QuickPick.RandomWinnings(); winningBall.WinningBallCount = 6; winningBall.WinningPowerball = true; return(winningBall); }
public BallersDraftObj() { // Make sure the Current Draft starts with a 'Keep' or 'Empty' in every slot lock (_DraftLock) { int intKeep = (int)DraftMoveType.Keep; int intEmpty = (int)DraftMoveType.Empty; Dictionary <QuickPick, int> overrides = GetDraftOverrides(); var query = from t in db.DraftMoves where t.SeasonID == Settings.DraftSeasonID && (t.MoveType == intKeep || t.MoveType == intEmpty) select new DraftMoveObj(t); if (query.Count() < (Settings.RoundsPerDraft * Settings.TeamsPerDraft)) { int intMoveType = (int)DraftMoveType.Empty; DateTime runTime = DateTime.Now; Dictionary <int, int> draftOrder = GetDraftOrder(); if (draftOrder.Count == 0) { throw new InvalidOperationException("There is no draft order for the current season, please ensure there is valid draft order data in the database"); } Dictionary <QuickPick, DraftMoveObj> existing = new Dictionary <QuickPick, DraftMoveObj>(); foreach (DraftMoveObj nextMove in query) { existing[nextMove.Index] = nextMove; } // for (int round = 1; round <= Settings.RoundsPerDraft; round++) for (QuickPick index = new QuickPick() { Round = 1, Pick = 1 }; index.Round <= Settings.RoundsPerDraft; index.Round++) { for (index.Pick = 1; index.Pick <= Settings.TeamsPerDraft; index.Pick++) { if (!existing.ContainsKey(index)) { DraftMove temp = new DraftMove() { Round = index.Round, Pick = index.Pick, MoveType = intMoveType, PlayerID = null, SeasonID = Settings.DraftSeasonID, Time = runTime, UserID = overrides.ContainsKey(index) ? overrides[index] : draftOrder[index.Pick] }; db.DraftMoves.InsertOnSubmit(temp); } } } db.SubmitChanges(); } } }
private List <DraftPickStatusObj> GetDraftPicks() { DraftUser user = DraftAuthentication.AuthenticateRequest(Request); List <DraftPickStatusObj> toRet = new List <DraftPickStatusObj>(); List <DraftMoveObj> onTheClock = new List <DraftMoveObj>(); Dictionary <QuickPick, DraftMoveObj> draftData = dataSource.QueryDraftData(out onTheClock); DraftPickStatusObj onClockPick = null; DraftMoveObj lastOnClockMoveObj = null; for (QuickPick index = new QuickPick(); index.Round <= BallersDraftObj.Settings.RoundsPerDraft; index.Round++) { for (index.Pick = 1; index.Pick <= BallersDraftObj.Settings.TeamsPerDraft; index.Pick++) { DraftMoveObj nextMove = draftData[index]; toRet.Add(new DraftPickStatusObj(BallersDraftObj.Settings.TeamsPerDraft) { Round = nextMove.Round, Pick = nextMove.Pick, Team = nextMove.UserID, Player = nextMove.PlayerID, Type = nextMove.TypeInt }); } } foreach (DraftMoveObj currMove in onTheClock) { lastOnClockMoveObj = currMove; onClockPick = new DraftPickStatusObj(BallersDraftObj.Settings.TeamsPerDraft) { Round = currMove.Round, Pick = currMove.Pick, Team = currMove.UserID, Type = currMove.TypeInt }; toRet[onClockPick.TotalPick - 1] = onClockPick; } if (lastOnClockMoveObj != null) { TimeSpan timeLeft = TimeSpan.FromSeconds(BallersDraftObj.Settings.SecondsPerPick) - (DateTime.Now - lastOnClockMoveObj.Time); if (timeLeft < TimeSpan.FromTicks(0)) { timeLeft = TimeSpan.FromTicks(0); } onClockPick.TimeLeft = (int)timeLeft.TotalSeconds; } return(toRet); }
private List<DraftPickStatusObj> GetDraftPicks() { DraftUser user = DraftAuthentication.AuthenticateRequest(Request); List<DraftPickStatusObj> toRet = new List<DraftPickStatusObj>(); List<DraftMoveObj> onTheClock = new List<DraftMoveObj>(); Dictionary<QuickPick, DraftMoveObj> draftData = dataSource.QueryDraftData(out onTheClock); DraftPickStatusObj onClockPick = null; DraftMoveObj lastOnClockMoveObj = null; for (QuickPick index = new QuickPick(); index.Round <= BallersDraftObj.Settings.RoundsPerDraft; index.Round++) { for (index.Pick = 1; index.Pick <= BallersDraftObj.Settings.TeamsPerDraft; index.Pick++) { DraftMoveObj nextMove = draftData[index]; toRet.Add(new DraftPickStatusObj(BallersDraftObj.Settings.TeamsPerDraft) { Round = nextMove.Round, Pick = nextMove.Pick, Team = nextMove.UserID, Player = nextMove.PlayerID, Type = nextMove.TypeInt }); } } foreach (DraftMoveObj currMove in onTheClock) { lastOnClockMoveObj = currMove; onClockPick = new DraftPickStatusObj(BallersDraftObj.Settings.TeamsPerDraft) { Round = currMove.Round, Pick = currMove.Pick, Team = currMove.UserID, Type = currMove.TypeInt }; toRet[onClockPick.TotalPick - 1] = onClockPick; } if (lastOnClockMoveObj != null) { TimeSpan timeLeft = TimeSpan.FromSeconds(BallersDraftObj.Settings.SecondsPerPick) - (DateTime.Now - lastOnClockMoveObj.Time); if (timeLeft < TimeSpan.FromTicks(0)) timeLeft = TimeSpan.FromTicks(0); onClockPick.TimeLeft = (int)timeLeft.TotalSeconds; } return toRet; }
public static int GetPowerballNumber() { Console.Clear(); Prompt.PowerballInstructions(); bool validInput = false; int number = 0; while (!validInput) { bool validOutput = false; int output = 0; while (!validOutput) { Console.Write("Enter a number for your powerball : "); string input = Console.ReadLine(); if (input.Equals("quickpick", StringComparison.CurrentCultureIgnoreCase)) { number = QuickPick.RandomPowerball(); validInput = true; validOutput = true; } else if (InputToInt(input)) { output = int.Parse(input); validOutput = true; } else { Console.Clear(); Prompt.PowerballInstructions(); Console.WriteLine("That was not a number!"); } } if (Validate.ValidPowerballRange(output)) { number = output; validInput = true; } else { Console.Clear(); Prompt.PowerballInstructions(); Console.WriteLine("That was not a number from 1 to 26!"); } } return(number); }
public static int GetFirstFiveNumber(string place) { Console.Clear(); Prompt.FirstFiveInstructions(); bool validOutput = false; int number = 0; while (!validOutput) { bool validInput = false; int output = 0; while (!validInput) { Console.Write("Enter your " + place + " pick number : "); string input = Console.ReadLine(); if (input.Equals("quickpick", StringComparison.CurrentCultureIgnoreCase)) { number = QuickPick.RandomBall() + 100; validInput = true; validOutput = true; } else if (InputToInt(input)) { output = int.Parse(input); validInput = true; } else { Console.Clear(); Prompt.FirstFiveInstructions(); Console.WriteLine("That was not a number!"); } } if (Validate.ValidFirstFiveRange(output)) { number = output; validOutput = true; } else { Console.Clear(); Prompt.FirstFiveInstructions(); Console.WriteLine("That was not a number from 1 to 69!"); } } return(number); }
public BallersDraftObj() { // Make sure the Current Draft starts with a 'Keep' or 'Empty' in every slot lock (_DraftLock) { int intKeep = (int)DraftMoveType.Keep; int intEmpty = (int)DraftMoveType.Empty; Dictionary<QuickPick, int> overrides = GetDraftOverrides(); var query = from t in db.DraftMoves where t.SeasonID == Settings.DraftSeasonID && (t.MoveType == intKeep || t.MoveType == intEmpty) select new DraftMoveObj(t); if (query.Count() < (Settings.RoundsPerDraft * Settings.TeamsPerDraft)) { int intMoveType = (int)DraftMoveType.Empty; DateTime runTime = DateTime.Now; Dictionary<int, int> draftOrder = GetDraftOrder(); Dictionary<QuickPick, DraftMoveObj> existing = new Dictionary<QuickPick, DraftMoveObj>(); foreach (DraftMoveObj nextMove in query) { existing[nextMove.Index] = nextMove; } // for (int round = 1; round <= Settings.RoundsPerDraft; round++) for (QuickPick index = new QuickPick() { Round = 1, Pick = 1 }; index.Round <= Settings.RoundsPerDraft; index.Round++) { for (index.Pick = 1; index.Pick <= Settings.TeamsPerDraft; index.Pick++) { if (!existing.ContainsKey(index)) db.DraftMoves.InsertOnSubmit(new DraftMove() { Round = index.Round, Pick = index.Pick, MoveType = intMoveType, PlayerID = null, SeasonID = Settings.DraftSeasonID, Time = runTime, UserID = overrides.ContainsKey(index) ? overrides[index] : draftOrder[index.Pick] }); } } db.SubmitChanges(); } } }
public static int QuickpickUntilRight(List <int> numbers, int ball, int index) { ball -= 100; bool validQuickpick = false; while (!validQuickpick) { numbers.Add(ball); if (Validate.NoFirstFiveOverlap(numbers)) { validQuickpick = true; } else { numbers.RemoveAt(index); ball = QuickPick.RandomBall(); } } return(ball); }
/// <summary> /// NOTE: You MUST Lock before calling this function if you are going to use the date to write /// </summary> /// <returns></returns> private DraftMoveObj FindNextEmptySlot() { DraftMoveObj toRet = null; Dictionary <QuickPick, DraftMoveObj> draft = GetDraftStatus(); for (QuickPick index = new QuickPick() { Round = 1, Pick = 1 }; index.Round <= Settings.RoundsPerDraft && toRet == null; index.Round++) { for (index.Pick = 1; index.Pick <= Settings.TeamsPerDraft; index.Pick++) { if (draft[index].IsEmpty) { toRet = draft[index]; break; } } } return(toRet); }
public static Pick QuickPickLickitySplit(string name) { List <int> balls = new List <int>(); balls.Add(QuickPick.RandomBall()); PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 1); PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 2); PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 3); PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 4); Pick pick = new Pick(); pick.Name = name; pick.FirstBall = balls[0]; pick.SecondBall = balls[1]; pick.ThirdBall = balls[2]; pick.FourthBall = balls[3]; pick.FifthBall = balls[4]; pick.PowerBall = QuickPick.RandomPowerball(); return(pick); }
/// <summary> /// NOTE: You MUST Lock before calling this function /// </summary> /// <returns></returns> private List <DraftMove> GetCurrentOnClock_Internal() { List <DraftMove> toRet = new List <DraftMove>(); Dictionary <QuickPick, DraftMoveObj> Picked = new Dictionary <QuickPick, DraftMoveObj>(); int intClock = (int)DraftMoveType.OnClock; var allOnClock = from t in db.DraftMoves where t.MoveType == intClock && t.SeasonID == Settings.DraftSeasonID select t; int intPick = (int)DraftMoveType.Pick; var allPicked = from t in db.DraftMoves where t.MoveType == intPick && t.SeasonID == Settings.DraftSeasonID select t; foreach (DraftMove mPicked in allPicked) { Picked[new QuickPick() { Round = mPicked.Round, Pick = mPicked.Pick }] = new DraftMoveObj(mPicked); } foreach (DraftMove mOnClock in allOnClock) { QuickPick index = new QuickPick() { Round = mOnClock.Round, Pick = mOnClock.Pick }; if (!Picked.ContainsKey(index)) { toRet.Add(mOnClock); } } return(toRet); }
/// <summary> /// NOTE: You MUST Lock before calling this function if you are going to use the data to write /// </summary> /// <returns></returns> private Dictionary <QuickPick, DraftMoveObj> GetDraftStatus() { Dictionary <QuickPick, DraftMoveObj> data = new Dictionary <QuickPick, DraftMoveObj>(); Dictionary <QuickPick, int> overrides = GetDraftOverrides(); // Retrieve all moves from the DB var allMoves = from t in db.DraftMoves where t.SeasonID == Settings.DraftSeasonID select new DraftMoveObj(t); // Loop through all moves and overwrite the empty values with actual ones foreach (DraftMoveObj move in allMoves) { QuickPick index = new QuickPick() { Round = move.Round, Pick = move.Pick }; // Check for an override and update the UserID if (overrides.ContainsKey(index)) { move.UserID = overrides[index]; } // If no data exists, add it if (!data.ContainsKey(index)) { data[index] = move; } // Only overwrite if the Pick is Open (Empty or OnClock) // Empty means there is no data, and OnClock is only valid until a Pick happens else if (!data[index].IsPicked && (move.IsPicked || data[index].Type == DraftMoveType.Empty)) { data[index] = move; } } return(data); }
/// <summary> /// NOTE: You MUST Lock before calling this function if you are going to use the data to write /// </summary> /// <returns></returns> private Dictionary<QuickPick, DraftMoveObj> GetDraftStatus() { Dictionary<QuickPick, DraftMoveObj> data = new Dictionary<QuickPick, DraftMoveObj>(); Dictionary<QuickPick, int> overrides = GetDraftOverrides(); // Retrieve all moves from the DB var allMoves = from t in db.DraftMoves where t.SeasonID == Settings.DraftSeasonID select new DraftMoveObj(t); // Loop through all moves and overwrite the empty values with actual ones foreach (DraftMoveObj move in allMoves) { QuickPick index = new QuickPick() { Round = move.Round, Pick = move.Pick }; // Check for an override and update the UserID if (overrides.ContainsKey(index)) move.UserID = overrides[index]; // If no data exists, add it if (!data.ContainsKey(index)) data[index] = move; // Only overwrite if the Pick is Open (Empty or OnClock) // Empty means there is no data, and OnClock is only valid until a Pick happens else if (!data[index].IsPicked && (move.IsPicked || data[index].Type == DraftMoveType.Empty)) data[index] = move; } return data; }
/// <summary> /// NOTE: You MUST Lock before calling this function /// </summary> /// <returns></returns> private List<DraftMove> GetCurrentOnClock_Internal() { List<DraftMove> toRet = new List<DraftMove>(); Dictionary<QuickPick, DraftMoveObj> Picked = new Dictionary<QuickPick, DraftMoveObj>(); int intClock = (int)DraftMoveType.OnClock; var allOnClock = from t in db.DraftMoves where t.MoveType == intClock && t.SeasonID == Settings.DraftSeasonID select t; int intPick = (int)DraftMoveType.Pick; var allPicked = from t in db.DraftMoves where t.MoveType == intPick && t.SeasonID == Settings.DraftSeasonID select t; foreach (DraftMove mPicked in allPicked) { Picked[new QuickPick() { Round = mPicked.Round, Pick = mPicked.Pick }] = new DraftMoveObj(mPicked); } foreach (DraftMove mOnClock in allOnClock) { QuickPick index = new QuickPick() { Round = mOnClock.Round, Pick = mOnClock.Pick }; if (!Picked.ContainsKey(index)) { toRet.Add(mOnClock); } } return toRet; }
/// <summary> /// NOTE: You MUST Lock before calling this function if you are going to use the date to write /// </summary> /// <returns></returns> private DraftMoveObj FindNextEmptySlot() { DraftMoveObj toRet = null; Dictionary<QuickPick, DraftMoveObj> draft = GetDraftStatus(); for (QuickPick index = new QuickPick() { Round = 1, Pick = 1 }; index.Round <= Settings.RoundsPerDraft && toRet == null; index.Round++) { for (index.Pick = 1; index.Pick <= Settings.TeamsPerDraft; index.Pick++) { if (draft[index].IsEmpty) { toRet = draft[index]; break; } } } return toRet; }
public static string GetName() { int number = QuickPick.RandomBall(); switch (number) { case 1: return("Michael Porter"); case 2: return("Krystine Hughes"); case 3: return("Derek Petricka"); case 4: return("Derek Lysne"); case 5: return("Edward Chavie"); case 6: return("Caleb Geary"); case 7: return("Cayden Elmore"); case 8: return("Josh Beese"); case 9: return("Zach Beese"); case 10: return("Max Gartner"); case 11: return("Ian Gartner"); case 12: return("Patricia Gartner"); case 13: return("Christopher Gartner"); case 14: return("Christopher Remke"); case 15: return("Ian Gunderson"); case 16: return("Kendra Born"); case 17: return("Teejay Barnett"); case 18: return("Jacobi Larscheid"); case 19: return("Tyler King"); case 20: return("Pete Anderson"); case 21: return("Tyler Anderson"); case 22: return("Jake Anderson"); case 23: return("Drew Anderson"); case 24: return("Catherine Anderson"); case 25: return("Marie Anderson"); case 26: return("Brandon Thompson"); case 27: return("Jackson Schultz"); case 28: return("Preston Osterhus"); case 29: return("Alisha Grobner"); case 30: return("Michael Parsons"); case 31: return("Janzen Staska"); case 32: return("Arden Anderson"); case 33: return("Kevin House"); case 34: return("Calvin Heidi"); case 35: return("Heather Heeman"); case 36: return("Ashley Williams"); case 37: return("Jack Shepherd"); case 38: return("Dexter Holland"); case 39: return("Victor Von Frankenstein"); case 40: return("Gaius Julius Caesar"); case 41: return("John Johnson"); case 42: return("Jack Jackson"); case 43: return("Robert Robertson"); case 44: return("Bill Williamson"); case 45: return("Dick Richardson"); case 46: return("Thomas Thompson"); case 47: return("Gunther Gunderson"); case 48: return("Andrew Anderson"); case 49: return("Erik Erikson"); case 50: return("Mike Michaelson"); case 51: return("Hot Gravy Platter"); case 52: return("A Bucket of Rotting Fish"); case 53: return("Carpet Stain"); case 54: return("Chuck Testa"); case 55: return("Snot Soup"); case 56: return("Can't Think of New Name"); case 57: return("Brad Pitt"); case 58: return("Plastic Bag"); case 59: return("Rubber Band"); case 60: return("Stray Hamster"); case 61: return("An Angry Turtle"); case 62: return("Please Make"); case 63: return("This Name Generation"); case 64: return("Stop Thank You"); default: return("Riley Gartner"); } }