private List<StartingHand> GetPossibleStartingHands() { var h1 = GetPossibleHands(); //remove last 3 because there is no hand after them h1.RemoveAt(h1.Count - 1); h1.RemoveAt(h1.Count - 1); h1.RemoveAt(h1.Count - 1); Parallel.ForEach(h1, h => { MDUContext _db = new MDUContext(); Deck d = new Deck(h[0].Id); d.RemoveCards(h); List<List<Card>> hands = new List<List<Card>>(); List<Card> currHand = new List<Card>(); List<Card> nextHand = new List<Card>(d.DealNextCards(2)); while (nextHand != null) { d.AddCardsBackToDeckInOrder(currHand); currHand = d.DealCards(nextHand); hands.Add(currHand); _db.HeadToHeadStats.Add(new HeadToHeadStat(new Hand(h), new Hand(currHand), 0, 0, 0)); nextHand = iCalc.GetNextHand(nextHand, d.Cards); } _db.SaveChanges(); }); return null; }
public JsonResult SetupStartHands() { return null; var db = new MDUContext(); var h2h = new HeadToHeadStat(); //if (db.HeadToHeadStats.ToList().Count() == 812175) // return null; //else { h2h.SetupStartingHands(); } return null; }