public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var betTable = Generate.BetNumbers(); var generate = random.Next(0, 38); var arr1 = BetTable.NumbersArray1; var arr2 = BetTable.NumbersArray2; var arr3 = BetTable.NumbersArray3; var arrName1 = new Dictionary <string, int>(); var arrName2 = new Dictionary <string, int>(); var arrName3 = new Dictionary <string, int>(); var arrName4 = new Dictionary <string, int>(); int index1 = Array.FindIndex(arr1, position => position == one); int index2 = Array.FindIndex(arr2, position => position == one); int index3 = Array.FindIndex(arr3, position => position == one); bool null1 = index1 != 0; bool null2 = index2 != 0; bool null3 = index3 != 0; int total = index1 + index2 + index3; if (one == 0) { var(zeroPicks, odds) = HandleZeros(one); this.zeroPicks = zeroPicks; this.odds = odds; } else if (one == 37) { var(zeroPicks, odds) = HandleZeros(one); this.zeroPicks = zeroPicks; this.odds = odds; } else if (four == 1) { var(odds, arrName12, arrName22, arrName32, arrName42) = HandleFour(total, arr1, arr2, arr3, index1, index2, index3, arrName1, arrName2, arrName3, arrName4, null1, null2, null3); this.odds = odds; arrName1 = arrName12; arrName2 = arrName22; arrName3 = arrName32; } else if (two == 1) { var(odds, arrName12, arrName22, arrName32, arrName42) = HandleTwo(total, arr1, arr2, arr3, index1, index2, index3, arrName1, arrName2, arrName3, arrName4, null1, null2, null3); this.odds = odds; arrName1 = arrName12; arrName2 = arrName22; arrName3 = arrName32; } if (one == 0 || one == 37) { bool match = false; foreach (var item in this.zeroPicks) { Console.WriteLine($" Winning Number = {generate}"); if (item == generate) { match = true; } } if (match) { return(OnWin(money, this.odds)); } else { return(OnLose(money)); } } else if (four == 1) { return(WinningDeterminationFour(arrName1, arrName2, arrName3, arrName4, generate, money)); } else if (two == 1) { return(WinningDeterminationTwo(arrName1, arrName2, arrName3, arrName4, generate, money)); } Console.WriteLine("..."); return(money); }