static void Main(string[] args) { Combination <int, string> winingCombinaton = new Combination <int, string>(1, 2, 3, "a", "b", "a"); LottoGame <int, string> startGame = new LottoGame <int, string>(winingCombinaton); LottoResult result = startGame.AddUserCombination(new Combination <int, string>(0, 2, 3, "a", "k", "k")); Console.WriteLine("{0}, matched combination: {1}", result.IsWinning, result.MatchedNumbersCount); }
static void Main(string[] args) { Combination <int, string> winningCombination = new Combination <int, string>(1, 2, 3, "a", "b", "c"); Combination <int, string> newCombination = new Combination <int, string>(1, 2, 3, "a", "c", "b"); LottoGame <int, string> obj = new LottoGame <int, string>(winningCombination); obj.AddUserCombination(newCombination); LottoResult <int, string> obj1 = new LottoResult <int, string>(winningCombination, newCombination); }
public LottoResult AddUserCombination(Combination <T, U> comb) { bool exist = ValidateCombination(comb); LottoResult lotoRes = new LottoResult(); if (!exist) { addedComb.Add(comb); } else { Console.WriteLine("This combination exist"); } if (winningCombination.Elem1.Equals(comb.Elem1)) { lotoRes.MatchedNumbersCount++; } if (winningCombination.Elem2.Equals(comb.Elem2)) { lotoRes.MatchedNumbersCount++; } if (winningCombination.Elem3.Equals(comb.Elem3)) { lotoRes.MatchedNumbersCount++; } if (winningCombination.Elem4.Equals(comb.Elem4)) { lotoRes.MatchedNumbersCount++; } if (winningCombination.Elem5.Equals(comb.Elem5)) { lotoRes.MatchedNumbersCount++; } if (winningCombination.Elem6.Equals(comb.Elem6)) { lotoRes.MatchedNumbersCount++; } if (lotoRes.MatchedNumbersCount >= 3) { lotoRes.IsWinning = true; } return(lotoRes); }