public void InitializeRouletteTest() { RouletteTable tableOne = new RouletteTable(); Assert.AreEqual(tableOne.Numbers[0].Colour, null); Assert.AreEqual(tableOne.Numbers[0].Parity, null); Assert.AreEqual(tableOne.Numbers[0].Dozen, null); Assert.AreEqual(tableOne.Numbers[3].Colour, ColourEnum.Red); Assert.AreEqual(tableOne.Numbers[3].Parity, ParityEnum.Odd); Assert.AreEqual(tableOne.Numbers[3].Dozen, DozenEnum.DozenOne); Assert.AreEqual(tableOne.Numbers[18].Colour, ColourEnum.Red); Assert.AreEqual(tableOne.Numbers[18].Parity, ParityEnum.Even); Assert.AreEqual(tableOne.Numbers[18].Dozen, DozenEnum.DozenTwo); Assert.AreEqual(tableOne.Numbers[29].Colour, ColourEnum.Black); Assert.AreEqual(tableOne.Numbers[29].Parity, ParityEnum.Odd); Assert.AreEqual(tableOne.Numbers[29].Dozen, DozenEnum.DozenThree); Assert.AreEqual(tableOne.Numbers[36].Colour, ColourEnum.Red); Assert.AreEqual(tableOne.Numbers[36].Parity, ParityEnum.Even); Assert.AreEqual(tableOne.Numbers[36].Dozen, DozenEnum.DozenThree); Assert.AreEqual(tableOne.Players.Count, 0); Assert.AreEqual(tableOne.Observers.Count, 0); }
public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var generate = random.Next(1, 37); Console.WriteLine($"Result: {RouletteTable.PrintName(generate)}"); if (Enumerable.Range(1, 7).Contains(generate) && one == 1 && four == 0) { return(OnWin(money)); } if (Enumerable.Range(7, 13).Contains(generate) && two == 1 && four == 0) { return(OnWin(money)); } if (Enumerable.Range(13, 19).Contains(generate) && three == 1) { return(OnWin(money)); } if (Enumerable.Range(19, 25).Contains(generate) && four == 1 && one == 0 && two == 0) { return(OnWin(money)); } if (Enumerable.Range(25, 31).Contains(generate) && one == 1 && four == 1) { return(OnWin(money)); } if (Enumerable.Range(31, 37).Contains(generate) && two == 1 && four == 1) { return(OnWin(money)); } else { return(OnLose(money)); } }
public void AddBotsTest() { RouletteTable tableOne = new RouletteTable(); Player playerOne = new BotDAlembert("TestBotDAlembert", 27000); tableOne.AddPlayer(playerOne); Assert.AreEqual(tableOne.Players.Count, 1); Assert.AreEqual(tableOne.Players[0], playerOne); Assert.AreEqual(tableOne.Players[0].Deposit, 27000); playerOne.ShowInfo(); Player playerTwo = new BotLabouchere("TestBotLabouchere", 3000); tableOne.AddPlayer(playerTwo); Assert.AreEqual(tableOne.Players.Count, 2); Assert.AreEqual(tableOne.Players[1], playerTwo); Assert.AreEqual(tableOne.Players[1].Deposit, 3000); playerTwo.ShowInfo(); Player playerThree = new BotMartingale("TestBotMartingale", 7000); tableOne.AddPlayer(playerThree); Assert.AreEqual(tableOne.Players.Count, 3); Assert.AreEqual(tableOne.Players[2], playerThree); Assert.AreEqual(tableOne.Players[2].Deposit, 7000); playerThree.ShowInfo(); }
public void SpinBotMartingaleTest() { RouletteTable tableOne = new RouletteTable(); Player playerOne = new BotDAlembert("TestBotMartingaleOne", 0); tableOne.AddPlayer(playerOne); tableOne.Spin(); Assert.AreEqual(tableOne.Observers[0], playerOne); Player playerTwo = new BotMartingale("TestBotMartingaleTwo", 3000); tableOne.AddPlayer(playerTwo); tableOne.Spin(); tableOne.ShowInfoAboutPlayers(); Assert.AreEqual(tableOne.Players[0].Name, "TestBotMartingaleTwo"); Assert.AreEqual(tableOne.Players[0].AmountOfBets, 1); int oldBalance = tableOne.Players[0].Balance; tableOne.Spin(); tableOne.ShowInfoAboutPlayers(); Assert.AreEqual(tableOne.Players[0].AmountOfBets, 2); Assert.AreNotEqual(tableOne.Players[0].Balance, oldBalance); }
public void MakeBetBotMartingaleTest() { RouletteTable tableOne = new RouletteTable(); Player newBot = new BotMartingale("TestBotMartingaleOne", 0); List <Bet> newList = newBot.MakeBet(0); Assert.AreEqual(newList, null); Player playerTwo = new BotMartingale("TestBotMartingaleTwo", 15000); tableOne.AddPlayer(playerTwo); int bets = 0; newList = tableOne.Players[0].MakeBet(0); Assert.AreEqual(newList[0].Player, 0); int unit = playerTwo.Deposit / 40; Assert.AreEqual(newList[0].Money, unit); Assert.AreEqual(playerTwo.AmountOfBets, 0); while (tableOne.Observers.Count == 0) { tableOne.Spin(); if (tableOne.Observers.Count == 0) { bets++; } Assert.AreEqual(playerTwo.AmountOfBets, bets); Assert.AreEqual(playerTwo.Profit, playerTwo.Balance - 15000); } playerTwo.ShowInfo(); }
static void Main(string[] args) { Console.WriteLine("Welcome to LUCKY ROULETTE!"); Console.WriteLine(""); if (args.Length != 1) { Console.WriteLine("Incorrect amount of parameters. Only one needed."); return; } List <Type> bots = new BotLoader().FindBots(args[0], typeof(Bot)); if (bots == null) { return; } RouletteTable tableOne = new RouletteTable(); for (int x = 0; x < bots.Count; x++) { object[] parameters = { bots[x].Name, 1000 }; tableOne.AddPlayer((Player)Activator.CreateInstance(bots[x], parameters)); } for (int x = 0; x < 40; x++) { tableOne.Spin(); } Console.WriteLine(""); tableOne.ShowInfoAboutPlayers(); }
public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var generate = random.Next(0, 38); Console.WriteLine($"Result: {RouletteTable.PrintName(generate)}"); if (one == 1) { if (generate > 0 && generate < 19) { return(OnWin(money)); } else { return(OnLose(money)); } } else if (one == 2) { if (generate > 18 && generate < 37) { return(OnWin(money)); } else { return(OnLose(money)); } } else { return(OnLose(money)); } }
public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var number = random.Next(0, 38); Menu.ClearCompletely(); Console.WriteLine($"Result: {RouletteTable.PrintName(number)}"); if (one == number) { return(OnWin(money)); } else { return(OnLose(money)); } }
static void Main() { Console.WriteLine("Welcome to LUCKY ROULETTE!"); Console.WriteLine(""); RouletteTable tableOne = new RouletteTable(); tableOne.AddPlayer(new BotDAlembert("BotDAlembert", 1000)); tableOne.AddPlayer(new BotLabouchere("BotLabouchere", 1000)); tableOne.AddPlayer(new BotMartingale("BotMartingale", 1000)); for (int x = 0; x < 40; x++) { tableOne.Spin(); } Console.WriteLine(""); tableOne.ShowInfoAboutPlayers(); }
public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var generate = random.Next(1, 37); Console.WriteLine($"Result: {RouletteTable.PrintName(generate)}"); if (Enumerable.Range(1, 12).Contains(generate) && one == 1) { return(OnWin(money)); } if (Enumerable.Range(12, 24).Contains(generate) && one == 2) { return(OnWin(money)); } if (Enumerable.Range(24, 37).Contains(generate) && one == 3) { return(OnWin(money)); } else { return(OnLose(money)); } }
public decimal BetFunction(Random random, decimal money, int one = 0, int two = 0, int three = 0, int four = 0) { var generate = random.Next(1, 37); Console.WriteLine($"Result: {RouletteTable.PrintName(generate)}"); int min; int max; int middle; if (one == 1) { min = one; max = one + 2; middle = one + 1; } else if (one == 36) { min = one - 2; max = one; middle = one - 1; } else { min = one - 1; max = one + 1; middle = one; } if (generate == middle || generate == min || generate == max) { return(OnWin(money)); } else { return(OnLose(money)); } }
public void LoadTable() { _rouletteTable = _tableLoader.Load(@"./Assets/RouletteTable.txt"); }
public void Table_EnsureLimitGreaterThanZero() { var table = new RouletteTable(-1); Assert.Fail(); }
public virtual void SetUp() { _table100 = new RouletteTable(100); }
public bool TryGetTableById(long tableId, out RouletteTable table) { return(_rouletteTables.TryGetValue(tableId, out table)); }
public (int, Dictionary <string, int>, Dictionary <string, int>, Dictionary <string, int>, Dictionary <string, int>) HandleTwo(int total, int[] arr1, int[] arr2, int[] arr3, int index1, int index2, int index3, Dictionary <string, int> arrName1, Dictionary <string, int> arrName2, Dictionary <string, int> arrName3, Dictionary <string, int> arrName4, bool null1, bool null2, bool null3) { if (total == 0) { if (null1) { arrName1.Add(RouletteTable.PrintName(arr1[index1]), arr1[index1]); arrName1.Add(RouletteTable.PrintName(arr1[index1 + 1]), arr1[index1]); } else if (null2) { arrName1.Add(RouletteTable.PrintName(arr2[index2]), arr2[index2]); arrName1.Add(RouletteTable.PrintName(arr2[index2 + 1]), arr2[index2 + 1]); } else if (null3) { arrName1.Add(RouletteTable.PrintName(arr3[index3]), arr3[index3]); arrName1.Add(RouletteTable.PrintName(arr3[index3 + 1]), arr3[index3 + 1]); } } else if (total == 11) { if (null1) { arrName1.Add(RouletteTable.PrintName(arr1[index1]), arr1[index1]); arrName1.Add(RouletteTable.PrintName(arr1[index1 - 1]), arr1[index1]); } else if (null2) { arrName1.Add(RouletteTable.PrintName(arr2[index2]), arr2[index2]); arrName1.Add(RouletteTable.PrintName(arr2[index2 - 1]), arr2[index2 - 1]); } else if (null3) { arrName1.Add(RouletteTable.PrintName(arr3[index3]), arr3[index3]); arrName1.Add(RouletteTable.PrintName(arr3[index3 - 1]), arr3[index3 - 1]); } } else if (null1) { arrName1.Add(RouletteTable.PrintName(arr1[index1]), arr1[index1]); arrName1.Add(RouletteTable.PrintName(arr1[index1 - 1]), arr1[index1]); arrName2.Add(RouletteTable.PrintName(arr2[index1]), arr2[index1]); arrName2.Add(RouletteTable.PrintName(arr2[index1 + 1]), arr2[index1]); } else if (null2) { arrName1.Add(RouletteTable.PrintName(arr2[index2]), arr2[index2]); arrName1.Add(RouletteTable.PrintName(arr2[index2 - 1]), arr2[index2 - 1]); arrName2.Add(RouletteTable.PrintName(arr2[index2]), arr2[index2]); arrName2.Add(RouletteTable.PrintName(arr2[index2 + 1]), arr2[index2 + 1]); } else if (null3) { arrName1.Add(RouletteTable.PrintName(arr3[index3]), arr3[index3]); arrName1.Add(RouletteTable.PrintName(arr3[index3 - 1]), arr3[index3 - 1]); arrName2.Add(RouletteTable.PrintName(arr3[index3]), arr3[index3]); arrName2.Add(RouletteTable.PrintName(arr3[index3 + 1]), arr3[index3 + 1]); } this.odds = 8; return(8, arrName1, arrName2, arrName3, arrName4); }