public override void OnGameEnd(string gameString) { base.OnGameEnd(gameString); Assert.AreEqual(_privateCards, CurGameState.Players[Position].Hand.Substring(0, 5)); VerifyActions(gameString, 9, null, null); Assert.AreEqual(1, CurGameState.Round); Assert.AreEqual(14, CurGameState.Pot); Assert.AreEqual(4, CurGameState.Bet); Assert.AreEqual(2, CurGameState.BetCount); Assert.AreEqual(2, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(2, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(false, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(7, CurGameState.Players[0].InPot); Assert.AreEqual(4, CurGameState.Players[0].Bet); Assert.AreEqual(7, CurGameState.Players[0].Stack); Assert.AreEqual(7, CurGameState.Players[0].Result); Assert.AreEqual(14, CurGameState.Players[0].Hand.Length); Assert.AreEqual(false, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(7, CurGameState.Players[1].InPot); Assert.AreEqual(4, CurGameState.Players[1].Bet); Assert.AreEqual(-7, CurGameState.Players[1].Stack); Assert.AreEqual(-7, CurGameState.Players[1].Result); Assert.AreEqual(14, CurGameState.Players[1].Hand.Length); }
public override PokerAction OnActionRequired(string gameString) { // Program and verify the following moves. // // 0 Round: SB r, BB r, SB c // 1 Round: BB r, SB r, BB c base.OnActionRequired(gameString); if (Name == "Player0") { // Player0 is SB switch (OnActionRequiredCount) { // Round 0 case 1: VerifyActions(gameString, 2, null, "? ?"); Assert.AreEqual(0, CurGameState.Round); Assert.AreEqual(1.5, CurGameState.Pot); Assert.AreEqual(1, CurGameState.Bet); Assert.AreEqual(1, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(1, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(1, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(true, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(0.5, CurGameState.Players[0].InPot); Assert.AreEqual(0.5, CurGameState.Players[0].Bet); Assert.AreEqual(-.5, CurGameState.Players[0].Stack); Assert.AreEqual(true, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(1, CurGameState.Players[1].InPot); Assert.AreEqual(1, CurGameState.Players[1].Bet); Assert.AreEqual(-1, CurGameState.Players[1].Stack); return(PokerAction.r(0, 1)); case 2: VerifyActions(gameString, 4, null, "? ?"); Assert.AreEqual(0, CurGameState.Round); Assert.AreEqual(5, CurGameState.Pot); Assert.AreEqual(3, CurGameState.Bet); Assert.AreEqual(3, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(1, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(1, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(true, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(2, CurGameState.Players[0].InPot); Assert.AreEqual(2, CurGameState.Players[0].Bet); Assert.AreEqual(-2, CurGameState.Players[0].Stack); Assert.AreEqual(false, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(3, CurGameState.Players[1].InPot); Assert.AreEqual(3, CurGameState.Players[1].Bet); Assert.AreEqual(-3, CurGameState.Players[1].Stack); return(PokerAction.c(0)); // Round 1 case 3: VerifyActions(gameString, 7, null, "? ?"); Assert.AreEqual(1, CurGameState.Round); Assert.AreEqual(8, CurGameState.Pot); Assert.AreEqual(2, CurGameState.Bet); Assert.AreEqual(1, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(2, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(2, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(true, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(3, CurGameState.Players[0].InPot); Assert.AreEqual(0, CurGameState.Players[0].Bet); Assert.AreEqual(-3, CurGameState.Players[0].Stack); Assert.AreEqual(14, CurGameState.Players[0].Hand.Length); Assert.AreEqual(false, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(5, CurGameState.Players[1].InPot); Assert.AreEqual(2, CurGameState.Players[1].Bet); Assert.AreEqual(-5, CurGameState.Players[1].Stack); Assert.AreEqual(12, CurGameState.Players[1].Hand.Length); Assert.IsTrue(CurGameState.Players[1].Hand.StartsWith("? ?")); return(PokerAction.r(0, 1)); } } else { // Player1 is BB switch (OnActionRequiredCount) { // Round 0 case 1: VerifyActions(gameString, 3, "? ?", null); Assert.AreEqual(0, CurGameState.Round); Assert.AreEqual(3, CurGameState.Pot); Assert.AreEqual(2, CurGameState.Bet); Assert.AreEqual(2, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(1, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(1, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(false, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(2, CurGameState.Players[0].InPot); Assert.AreEqual(2, CurGameState.Players[0].Bet); Assert.AreEqual(-2, CurGameState.Players[0].Stack); Assert.AreEqual("? ?", CurGameState.Players[0].Hand); Assert.AreEqual(true, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(1, CurGameState.Players[1].InPot); Assert.AreEqual(1, CurGameState.Players[1].Bet); Assert.AreEqual(-1, CurGameState.Players[1].Stack); Assert.AreEqual(5, CurGameState.Players[1].Hand.Length); return(PokerAction.r(0, 1)); // Round 1 case 2: VerifyActions(gameString, 6, "? ?", null); Assert.AreEqual(1, CurGameState.Round); Assert.AreEqual(6, CurGameState.Pot); Assert.AreEqual(0, CurGameState.Bet); Assert.AreEqual(0, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(2, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(2, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(true, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(3, CurGameState.Players[0].InPot); Assert.AreEqual(0, CurGameState.Players[0].Bet); Assert.AreEqual(-3, CurGameState.Players[0].Stack); Assert.AreEqual(14, CurGameState.Players[1].Hand.Length); Assert.AreEqual(true, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(3, CurGameState.Players[1].InPot); Assert.AreEqual(0, CurGameState.Players[1].Bet); Assert.AreEqual(-3, CurGameState.Players[1].Stack); Assert.AreEqual(14, CurGameState.Players[1].Hand.Length); return(PokerAction.r(0, 1)); case 3: VerifyActions(gameString, 8, "? ?", null); Assert.AreEqual(1, CurGameState.Round); Assert.AreEqual(12, CurGameState.Pot); Assert.AreEqual(4, CurGameState.Bet); Assert.AreEqual(2, CurGameState.BetCount); Assert.AreEqual(Position, CurGameState.CurrentActor); Assert.AreEqual(2, CurGameState.GetMinBet(GameDefinition)); Assert.AreEqual(2, CurGameState.GetMaxBet(GameDefinition)); Assert.AreEqual(false, CurGameState.Players[0].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[0].CanActInGame); Assert.AreEqual(false, CurGameState.Players[0].IsFolded); Assert.AreEqual(false, CurGameState.Players[0].IsAllIn); Assert.AreEqual(7, CurGameState.Players[0].InPot); Assert.AreEqual(4, CurGameState.Players[0].Bet); Assert.AreEqual(-7, CurGameState.Players[0].Stack); Assert.AreEqual(12, CurGameState.Players[0].Hand.Length); Assert.IsTrue(CurGameState.Players[0].Hand.StartsWith("? ?")); Assert.AreEqual(true, CurGameState.Players[1].CanActInCurrentRound); Assert.AreEqual(true, CurGameState.Players[1].CanActInGame); Assert.AreEqual(false, CurGameState.Players[1].IsFolded); Assert.AreEqual(false, CurGameState.Players[1].IsAllIn); Assert.AreEqual(5, CurGameState.Players[1].InPot); Assert.AreEqual(2, CurGameState.Players[1].Bet); Assert.AreEqual(-5, CurGameState.Players[1].Stack); Assert.AreEqual(14, CurGameState.Players[1].Hand.Length); return(PokerAction.c(0)); } } Assert.Fail(); return(null); }