// Returns winnings for given bet public virtual double PlaceBetAndSpin(Bet b) { int result = _wheel.Spin(); Pocket pocket = _rouletteTable.GetPocket(result); return(b.CalculateWinnings(pocket)); }
private void EndRound() { HasEnded = true; Pocket = _wheel.Spin(); if (RoundEnded != null) { RoundEnded(this, new RoundEndedEventArgs("Round has ended")); // Update statement needs to be called here, after the round has ended. } }
public void Spin_ShouldReturnValidIPocket() { // Arrange // Act IPocket pocket = wheel.Spin(); Assert.True((int)pocket.Number < 37); Assert.True(pocket.Even == this.IsNumberEven((int)pocket.Number)); }
private void EndRound() { HasEnded = true; Pocket = _wheel.Spin(); this._roundTimer.Stop(); if (RoundEnded != null) { RoundEnded(this, new RoundEndedEventArgs("Round has ended")); } this._roundDAL.Update(this); }
public void WinningBlackAndEvenAndStraightTest() { // Gather bets from player int chipsOnBlack = 25; int chipsOnEven = 100; int chipsOnStraight = 100; int expectedReward = chipsOnBlack + chipsOnBlack * 1 + chipsOnEven + chipsOnEven * 1 + chipsOnStraight + chipsOnStraight * 35; // 250 + 35*100 = 3750 betsHolder.AddPlayerBet(BetDef.BetType.Black, chipsOnBlack); betsHolder.AddPlayerBet(BetDef.BetType.Even, chipsOnEven); betsHolder.AddPlayerBet(BetDef.BetType.Straight, chipsOnStraight, 2); // Spin and gather winning bets int winningNumber = fakeWheelAlwaysReturningNumber2.Spin(); List <Bet> winningBets = betsHolder.GetWinningBets(winningNumber); // Calculate final win int actualReward = WinCalculator.CalculatePlayerWinningAmount(winningBets); Assert.AreEqual(expectedReward, actualReward); }
/// <summary> /// The HandleSpin. /// </summary> /// <param name="player">The player<see cref="Player"/>.</param> /// <param name="puzzle">The puzzle<see cref="Puzzle"/>.</param> /// <param name="captureInput">The captureInput<see cref="ICaptureInput"/>.</param> /// <param name="wheel">The wheel<see cref="IWheel"/>.</param> /// <returns>The <see cref="bool"/>.</returns> private static bool HandleSpin(Player player, Puzzle puzzle, ICaptureInput captureInput, IWheel wheel) { int spinResult = wheel.Spin(); if (spinResult == -1) { if (!Console.IsOutputRedirected) { Console.Clear(); } player.RoundScore.Reset(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{player.Name}, Your spin result: Bankrupt. You lost all your round money!"); Console.ResetColor(); return(false); } else if (spinResult == 0) { if (!Console.IsOutputRedirected) { Console.Clear(); } Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{player.Name}, Your spin result: Lose A Turn\n"); Console.ResetColor(); return(false); } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Your spin result: ${spinResult}"); Console.ResetColor(); return(HandleGuess(player, puzzle, captureInput, spinResult)); } }
internal int SpinWheel() { return(wheel.Spin()); }