Ejemplo n.º 1
0
        public override void action(BJLoopContext context)
        {
            if (BJLogicHelper.round_complete(context.GameState))
            {
                context.BJLoop = new BJDealerTurn();
            }
            else
            {
                BJLogicHelper.debug_state(context.GameState);

                if (BJLogicHelper.cards_value(context.GameState.Player.Hand) >= BJLoop.BLACKJACK)
                {
                    if (context.GameState.Player.Split)
                    {
                        context.BJLoop = new BJPlayerSplitTurn();
                    }
                    else
                    {
                        context.GameState.Current_Player += 1;
                        context.BJLoop = new BJPlayerTurn();
                    }
                }
                else
                {
                    context.BJLoop = new BJPlayerAction();
                }
            }
        }
Ejemplo n.º 2
0
        public override void action(BJLoopContext context)
        {
            BJLogicHelper.debug_state(context.GameState);

            if (BJLogicHelper.cards_value(context.GameState.Player.Split_Hand) >= BJLoop.BLACKJACK)
            {
                context.GameState.Current_Player += 1;
                context.BJLoop = new BJPlayerTurn();
            }
            else
            {
                context.GameState.Player.action(context);
            }
        }
Ejemplo n.º 3
0
        public static void hitstand(BJLoopContext context)
        {
            int player_hand = BJLogicHelper.cards_value(context.GameState.Player.Hand);

            if (context.BJLoop.GetType() == typeof(BJPlayerSplitTurn))
            {
                player_hand = BJLogicHelper.cards_value(context.GameState.Player.Split_Hand);
            }

            if (player_hand < 17)
            {
                BJActions.hit(context);
            }
            else
            {
                BJActions.stand(context);
            }
        }
Ejemplo n.º 4
0
        public override void action(BJLoopContext context)
        {
            int dealer_hand = BJLogicHelper.cards_value(context.GameState.Dealer.Hand);

            while (dealer_hand < 17)
            {
                context.GameState.Deck.draw(context.GameState.Dealer.Hand);
                dealer_hand = BJLogicHelper.cards_value(context.GameState.Dealer.Hand);
            }

            if (dealer_hand == BLACKJACK)
            {
                context.BJLoop = new BJDealerWins();
            }
            else
            {
                context.BJLoop = new BJCalculateResults();
            }
        }