public Bank(Bank bank) { this.WinningTotal = bank.WinningTotal; //if (this.CurrentBank >= this.BankStart) //{ //} this.WinningCurrent = (int)((bank.WinningCurrent * .11) + bank.WinningCurrent); this.CurrentBank = bank.CurrentBank; this.BankStart = bank.BankStart; //COULD CHANGE THIS TO USE GET AND SET, PROBABLY LOOK ALOT NICER AND EASIER TO UNDERSTAND int temp =0; this.ABetAmount = (int)((this.WinningCurrent *.1) + this.WinningCurrent); temp = this.ABetAmount + this.WinningCurrent; this.BBetAmount = (int)((temp * .1) + temp); temp = this.BBetAmount + this.ABetAmount + this.WinningCurrent; this.CBetAmount = (int)((temp * .1) + temp); temp = this.CBetAmount + this.BBetAmount + this.ABetAmount + this.WinningCurrent; this.DBetAmount = (int)((temp * .1) + temp); this.RequiredBank = this.ABetAmount + this.BBetAmount + this.CBetAmount;// +this.DBetAmount; }
public ActionResult BankTest(int bettingType) { List<Bank> season = new List<Bank>(); Bank bank = new Bank(); bank.BankStart = 800; bank.CurrentBank = 800; bank.WinningCurrent = 100; bank.WinningTotal = 0; season.Add(bank); for (int i = 0; i < 100; i++) { Bank nextBank = new Bank(season[i]); nextBank.Win(); // nextBank.CashOut = 0; season.Add(nextBank); switch (bettingType) { case 0: break; case 1: // #region if (i == 10 || i == 20 || i == 30 || i == 40 || i == 50 || i == 60) { int newWinningTotal = (nextBank.WinningTotal / 2); //int newWinningTotal = (nextBank.WinningTotal / 2); int nextCurrentBank = nextBank.CurrentBank - newWinningTotal; Bank newBank = new Bank(); Bank tempBank = season.Where(s => s.RequiredBank <= nextCurrentBank).LastOrDefault(); newBank.ABetAmount = tempBank.ABetAmount; newBank.BankStart = tempBank.BankStart; newBank.BBetAmount = tempBank.BBetAmount; newBank.CashOut = tempBank.CashOut; newBank.CBetAmount = tempBank.CBetAmount; newBank.CurrentBank = tempBank.CurrentBank; newBank.DBetAmount = tempBank.DBetAmount; newBank.RequiredBank = tempBank.RequiredBank; newBank.WinningCurrent = tempBank.WinningCurrent; newBank.WinningTotal = tempBank.WinningTotal; newWinningTotal = newWinningTotal + (nextCurrentBank - tempBank.RequiredBank); newBank.CurrentBank = newBank.RequiredBank; newBank.WinningTotal = 0; newBank.CashOut = newWinningTotal; newBank.Win(); season.Add(newBank); i++; } #endregion break; case 2: break; case 3: break; } } return View("~/Views/Sports/NBA/BankTest.cshtml", season); }