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.UserCombination(newCombination); LottoResult<int, string> obj1 = new LottoResult<int, string>(winningCombination, newCombination); }
static void Main() { Console.ForegroundColor = ConsoleColor.Green; Console.Write("How many combinations will you enter: "); int numberOfCombinations = int.Parse(Console.ReadLine()); Console.WriteLine("\nA combination is comprised of 6 values. The first three values should share the same C# type(this should be the case with the second three values as well).\n"); Combination<int, string> winningCombination = new Combination<int, string>(new int[] { 1, 2, 3 }, new string[] { "pesho", "gosho", "ivan" }); LottoGame<int, string> lottoGame = new LottoGame<int, string>(winningCombination); Console.ForegroundColor = ConsoleColor.Yellow; int count = 1; while (count <= numberOfCombinations) { Console.Write("Combination {0}:\n", count); Console.Write("\tValue 1(int): "); int value1 = int.Parse(Console.ReadLine()); Console.Write("\tValue 2(int): "); int value2 = int.Parse(Console.ReadLine()); Console.Write("\tValue 3(int): "); int value3 = int.Parse(Console.ReadLine()); Console.Write("\tValue 4(string): "); string value4 = Console.ReadLine(); Console.Write("\tValue 5(string): "); string value5 = Console.ReadLine(); Console.Write("\tValue 6(string): "); string value6 = Console.ReadLine(); Combination<int, string> currentComb = new Combination<int, string>(new int[] { value1, value2, value3 }, new string[] { value4, value5, value6 }); if (lottoGame.CheckIfExists(currentComb)) { Console.WriteLine("The current combination has already been entered! Try again."); continue; } else { lottoGame.AddUserCombination(currentComb); } Console.WriteLine(); count++; } LottoResult<int, string> lottoResult = lottoGame.Validate(); if (lottoResult.IsWinning) { Console.WriteLine("Congratulations! Your best combination has {0} matching values!", lottoResult.MatchedNumbersCount); } else { Console.WriteLine("Unfortunately there are no winning combinations among the ones given."); } }
static void Main(string[] args) { List<Combination<int, string>> comboList = new List<Combination<int, string>>(); Combination<int, string> combo1 = new Combination<int, string>(1, 2, 6, "a", "b", "v"); Combination<int, string> combo2 = new Combination<int, string>(1, 2, 6, "a", "b", "v"); Combination<int, string> combo3 = new Combination<int, string>(1, 5, 3, "lotto", "totto", "v"); Combination<int, string> combo4 = new Combination<int, string>(3, 4, 5, "toto", "lotto", "game"); Combination<int, string> combo5 = new Combination<int, string>(1, 2, 6, "a", "b", "v"); comboList.Add(combo1); comboList.Add(combo2); comboList.Add(combo3); comboList.Add(combo4); comboList.Add(combo5); Combination<int, string>[] comboArray = comboList.ToArray(); LottoGame<int, string> lotto = new LottoGame<int, string>(comboArray); lotto.Validate(); }
/// <summary> /// Main method. /// </summary> public static void Main() { // List<List<object>> lottoGamesList = new List<List<object>>(); List<object> listOne = new List<object>() { 3.20, 'v', 1, "as" }; LottoGame<object> lottoGame = new LottoGame<object>(listOne); List<object> listTwo = new List<object>() { 3.20, 'v', "asa", 1 }; lottoGame.AddUserCombination(listTwo); List<object> listThree = new List<object>() { 3.20, 'v', "asaa", 1 }; lottoGame.AddUserCombination(listThree); // Console.WriteLine(String.Join(", ", lottoGame.userCombinations)); // Console.Write("Enter a combination of values :"); // List<object> listOne = new List<object>(); }
public static void Main() { Combination<int, string> winning = new Combination<int, string>(1, 2, 3, "ivan", "pesho", "gosho"); LottoGame<int,string> game = new LottoGame<int,string>(winning); while (true) { string[] input = Console.ReadLine().Split(' '); Combination<int, string> combination = new Combination<int, string>(int.Parse(input[0]),int.Parse(input[1]),int.Parse(input[2]),input[3],input[4],input[5]); game.Add(combination); var result = game.Validate(); Console.WriteLine("isWinning: {0}, MatchValues: {1}", result.isWinning,result.MatchedNumbersCount); if (input[0] == "stop") { break; } } }
static void Main(string[] args) { Console.WriteLine("---Generic Stack Test---"); GenericStack<int> stack = new GenericStack<int>(0); stack.Push(1); stack.Push(2); stack.Push(3); while(!stack.IsEmpty()) { Console.WriteLine(stack.Contains(2)); Console.WriteLine(stack.Peek()); Console.WriteLine(stack.Pop()); } Console.WriteLine("---Generic Dequeue Test---"); GenericDequeue<int> dequeue = new GenericDequeue<int>(0); dequeue.AddToEnd(3); dequeue.AddToEnd(4); dequeue.AddToFront(2); dequeue.AddToFront(1); while (!dequeue.IsEmpty()) { Console.WriteLine(dequeue.Contains(3)); Console.WriteLine(dequeue.PeekFromEnd()); Console.WriteLine(dequeue.RemoveFromEnd()); Console.WriteLine(dequeue.Contains(3)); Console.WriteLine(dequeue.PeekFromFront()); Console.WriteLine(dequeue.RemoveFromFront()); } Console.WriteLine("---Lotto Game Test---"); LottoGame<int, string> lottoGame = new LottoGame<int, string>(new Combination<int, string>(1, 2, 3, "a", "b", "c")); var comb1 = new Combination<int, string>(5, 7, 9, "we", "asd", "rgd"); var comb2 = new Combination<int, string>(5, 7, 8, "we", "asd", "rgd"); var comb3 = new Combination<int, string>(5, 7, 9, "we", "asd", "rgd"); var comb4 = new Combination<int, string>(1, 7, 9, "we", "asd", "rgd"); var comb5 = new Combination<int, string>(5, 2, 9, "we", "b", "rgd"); if (lottoGame.AddUserCombination(comb1)) Console.WriteLine("Added combination {0}", comb1); else Console.WriteLine("Combination {0} already exists!", comb1); if (lottoGame.AddUserCombination(comb2)) Console.WriteLine("Added combination {0}", comb2); else Console.WriteLine("Combination {0} already exists!", comb2); if (lottoGame.AddUserCombination(comb3)) Console.WriteLine("Added combination {0}", comb3); else Console.WriteLine("Combination {0} already exists!", comb3); if (lottoGame.AddUserCombination(comb4)) Console.WriteLine("Added combination {0}", comb4); else Console.WriteLine("Combination {0} already exists!", comb4); if (lottoGame.AddUserCombination(comb5)) Console.WriteLine("Added combination {0}", comb5); else Console.WriteLine("Combination {0} already exists!", comb5); Console.WriteLine(); var lottoResult = lottoGame.Validate(); if (lottoResult.IsWinning) Console.WriteLine("This lotto game has a winner with {0} matching values!", lottoResult.MatchedNumbersCount); else Console.WriteLine("There is no winner in this lotto game!"); Console.ReadKey(); }