示例#1
0
 public GamePlayer(PlayerPointManager pointManager, PlayerIdType idObject)
 {
     this.pointManager      = pointManager;
     this.idObject          = idObject;
     this.bet               = 0;
     this.winningsOrLosings = 0;
 }
示例#2
0
 public BlackjackPlayer(Blackjack <PlayerIdType> controller, PlayerPointManager pointManager, PlayerIdType playerIdObject)
     : base(pointManager, playerIdObject)
 {
     boughtInsurance      = false;
     this.controller      = controller;
     mainHandEvaluator    = new BlackjackCardListEvaluator(hand);
     splitHandEvaluator   = null;
     amountBetOnSplitHand = 0;
 }
示例#3
0
        private static TexasHoldem<int> CreateGame(bool setPlayer1To10 = false)
        {
            TexasHoldem<int> game = new TexasHoldem<int>();
            game.bigBlind = 2;
            for(int i = 0; i < 5; i++) {
                var pointManager = new PlayerPointManager();
                if(setPlayer1To10 && i == 0) {
                    pointManager.TotalPointsInAccount = 10;
                } else {
                    pointManager.TotalPointsInAccount = 100;
                }
                game.Join(i, pointManager);
            }

            return game;
        }
示例#4
0
        public void TexasHoldemTest8()
        {
            TexasHoldem<int> game = new TexasHoldem<int>();
            game.bigBlind = 2;

            var pointManager1 = new PlayerPointManager();
            pointManager1.TotalPointsInAccount = 100;
            var pointManager2 = new PlayerPointManager();
            pointManager2.TotalPointsInAccount = 100;
            game.Join(0, pointManager1);
            game.Join(1, pointManager2);

            game.StartGame();
            for(int i = 0; i < 2 * 4; i++) {
                Assert.IsTrue(game.round != TexasHoldem<int>.Round.GameOver);
                if(game.canCall) {
                    game.Call();
                } else {
                    game.Check();
                }
            }

            Assert.IsTrue(game.round == TexasHoldem<int>.Round.GameOver);

            if(game.lastGameWinners.First.Item1.idObject == 0) {
                Assert.IsTrue(pointManager1.TotalPointsInAccount == 102);
                Assert.IsTrue(pointManager2.TotalPointsInAccount == 98);
            } else {
                Assert.IsTrue(pointManager1.TotalPointsInAccount == 98);
                Assert.IsTrue(pointManager2.TotalPointsInAccount == 102);
            }
        }
示例#5
0
        public void TexasHoldemTest7()
        {
            TexasHoldem<int> game = new TexasHoldem<int>();
            game.bigBlind = 2;

            var pointManager1 = new PlayerPointManager();
            pointManager1.TotalPointsInAccount = 100;
            var pointManager2 = new PlayerPointManager();
            pointManager2.TotalPointsInAccount = 1000;
            game.Join(0, pointManager1);
            game.Join(1, pointManager2);

            game.StartGame();
            if(game.currentPlayer.idObject == 0) {
                game.Raise(ulong.MaxValue);
                game.Raise(ulong.MaxValue);
                game.Call();
            } else {
                game.Raise(ulong.MaxValue);
                game.Call();
            }

            Assert.IsTrue(game.round == TexasHoldem<int>.Round.GameOver);
            Assert.IsTrue(game.lastGameWinners.Count == 1);
            Assert.IsTrue(game.lastGameSidepotWinners.Count >= 1);

            if(game.lastGameSidepotWinners.Count == 1) {
                if(game.lastGameSidepotWinners.First.Item1.idObject == 0) {
                    Assert.IsTrue(pointManager1.TotalPointsInAccount == 200);
                    Assert.IsTrue(pointManager2.TotalPointsInAccount == 900);
                } else {
                    Assert.IsTrue(pointManager1.TotalPointsInAccount == 0);
                    Assert.IsTrue(pointManager2.TotalPointsInAccount == 1100);
                }
            }
        }