public with_a_deal_in_cards_action()
        {
            double_down_spec = MockRepository.GenerateStub<ICanDoubleDown>();
            split_spec = MockRepository.GenerateStub<ICanSplit>();
            insurance_spec = MockRepository.GenerateStub<ICanTakeInsurance>();

            card_shoe = MockRepository.GenerateStub<ICardShoe>();
            positions = MockRepository.GenerateStub<IPlayingPositions>();

            player = MockRepository.GenerateStub<IPlayer>();

            players_hand = MockRepository.GenerateStub<IPlayersHand>();
            positions.Stub(x => x.players_active_hand).Return(players_hand);
            dealers_hand = MockRepository.GenerateStub<IDealersHand>();
            positions.Stub(x => x.dealers_hand).Return(dealers_hand);

            hand = MockRepository.GenerateStub<IHand>();
            hands = new List<IHand>() { hand };
            positions.Stub(x => x.all_hands).Return(hands);

            hand_status_factory = MockRepository.GenerateStub<IHandStatusFactory>();
            annouce_winner_action = MockRepository.GenerateStub<IAnnouceWinnerAction>();

            SUT = new Domain.GamePlay.Model.Dealer.Actions.DealCardsIn(hand_status_factory, 
                                                                       annouce_winner_action,
                                                                       double_down_spec,
                                                                       split_spec,
                                                                       insurance_spec);
        }
Example #2
0
        public with_a_deal_in_cards_action()
        {
            double_down_spec = MockRepository.GenerateStub <ICanDoubleDown>();
            split_spec       = MockRepository.GenerateStub <ICanSplit>();
            insurance_spec   = MockRepository.GenerateStub <ICanTakeInsurance>();

            card_shoe = MockRepository.GenerateStub <ICardShoe>();
            positions = MockRepository.GenerateStub <IPlayingPositions>();

            player = MockRepository.GenerateStub <IPlayer>();

            players_hand = MockRepository.GenerateStub <IPlayersHand>();
            positions.Stub(x => x.players_active_hand).Return(players_hand);
            dealers_hand = MockRepository.GenerateStub <IDealersHand>();
            positions.Stub(x => x.dealers_hand).Return(dealers_hand);

            hand  = MockRepository.GenerateStub <IHand>();
            hands = new List <IHand>()
            {
                hand
            };
            positions.Stub(x => x.all_hands).Return(hands);

            hand_status_factory   = MockRepository.GenerateStub <IHandStatusFactory>();
            annouce_winner_action = MockRepository.GenerateStub <IAnnouceWinnerAction>();

            SUT = new Domain.GamePlay.Model.Dealer.Actions.DealCardsIn(hand_status_factory,
                                                                       annouce_winner_action,
                                                                       double_down_spec,
                                                                       split_spec,
                                                                       insurance_spec);
        }
Example #3
0
        public on_a_blackjacktable()
        {
            card_shoe         = MockRepository.GenerateStub <ICardShoe>();
            playing_positions = MockRepository.GenerateStub <IPlayingPositions>();
            table_status      = MockRepository.GenerateStub <ITableStatus>();
            player            = MockRepository.GenerateStub <IPlayer>();

            SUT = new BlackJackTable(player, card_shoe, playing_positions, table_status);
        }
        public on_a_blackjacktable()
        {            
            card_shoe = MockRepository.GenerateStub<ICardShoe>();
            playing_positions = MockRepository.GenerateStub<IPlayingPositions>();
            table_status = MockRepository.GenerateStub<ITableStatus>();
            player = MockRepository.GenerateStub<IPlayer>();

            SUT = new BlackJackTable(player, card_shoe, playing_positions, table_status);
        }
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);
            player.decrease_pot_by(playing_positions.players_active_hand.wager);
            playing_positions.players_active_hand.double_stake();

            playing_positions.players_active_hand.add(card_shoe.take_card());            
            playing_positions.players_active_hand.change_state_to(HandStatus.stick);
        }
 public void draw_cards_for_dealer_in(IPlayingPositions hands, ICardShoe card_shoe)
 {
     var dealers_hand = hands.dealers_hand;
     while (_can_hit_dealer.is_satisfied_by(dealers_hand))
     {
         dealers_hand.add(card_shoe.take_card());
         _hand_status_factory.set_status_for(dealers_hand);
     }
 }
Example #7
0
 public BlackJackTable(IPlayer player, ICardShoe card_shoe, IPlayingPositions playing_positions, ITableStatus table_status)
 {
     id                 = Guid.NewGuid();
     this.player        = player;
     _card_shoe         = card_shoe;
     _playing_positions = playing_positions;
     change_status_to(table_status);
     _playing_positions.create_dealers_hand_for(this);
 }
Example #8
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);
            player.decrease_pot_by(playing_positions.players_active_hand.wager);
            playing_positions.players_active_hand.double_stake();

            playing_positions.players_active_hand.add(card_shoe.take_card());
            playing_positions.players_active_hand.change_state_to(HandStatus.stick);
        }
Example #9
0
        public void draw_cards_for_dealer_in(IPlayingPositions hands, ICardShoe card_shoe)
        {
            var dealers_hand = hands.dealers_hand;

            while (_can_hit_dealer.is_satisfied_by(dealers_hand))
            {
                dealers_hand.add(card_shoe.take_card());
                _hand_status_factory.set_status_for(dealers_hand);
            }
        }
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            player.decrease_pot_by(playing_positions.players_active_hand.wager.halved());

            playing_positions.players_active_hand.mark_as_taken_insurance();

            playing_positions.players_active_hand.remove_offer_to_take_insurance();
        }
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            player.decrease_pot_by(playing_positions.players_active_hand.wager.halved());

            playing_positions.players_active_hand.mark_as_taken_insurance();

            playing_positions.players_active_hand.remove_offer_to_take_insurance();
        }
        private void deal_two_cards_to_each_hand_in(IPlayingPositions hands, ICardShoe card_shoe)
        {
            int no_of_cards_to_deal = 2;

            while (no_of_cards_to_deal > 0)
            {                
                hands.players_active_hand.add(card_shoe.take_card());
                hands.dealers_hand.add(card_shoe.take_card());
                
                no_of_cards_to_deal--;
            };            
        }
        private void deal_two_cards_to_each_hand_in(IPlayingPositions hands, ICardShoe card_shoe)
        {
            int no_of_cards_to_deal = 2;

            while (no_of_cards_to_deal > 0)
            {
                hands.players_active_hand.add(card_shoe.take_card());
                hands.dealers_hand.add(card_shoe.take_card());

                no_of_cards_to_deal--;
            }
            ;
        }
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            action_to_perform(playing_positions, card_shoe, player);

            update_hand_status(playing_positions);

            if (should_play_dealers_hand(playing_positions))
                play_dealers_hand(playing_positions, card_shoe, player);

            playing_positions.clear_all_first_hand_decision_offers();

            playing_positions.update_active_hand();
        }
Example #15
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            player.decrease_pot_by(playing_positions.players_active_hand.wager);

            playing_positions.split_players_hand();

            foreach (var hand in playing_positions.players_hands())
            {
                hand.add(card_shoe.take_card());
            }
        }
Example #16
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            player.decrease_pot_by(playing_positions.players_active_hand.wager);

            playing_positions.split_players_hand();

            foreach (var hand in playing_positions.players_hands())
            {
                hand.add(card_shoe.take_card());
            }                                        
        }
Example #17
0
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            action_to_perform(playing_positions, card_shoe, player);

            update_hand_status(playing_positions);

            if (should_play_dealers_hand(playing_positions))
            {
                play_dealers_hand(playing_positions, card_shoe, player);
            }

            playing_positions.clear_all_first_hand_decision_offers();

            playing_positions.update_active_hand();
        }
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions);

            deal_two_cards_to_each_hand_in(playing_positions, card_shoe);

            update_the_status_of_each_hand_in(playing_positions);

            if (playing_positions.player_has_blackjack())
                _annouce_winner_action.determine_winner_from(playing_positions, player);

            check_if_player_can_double_down(playing_positions);

            check_if_player_can_split(playing_positions);

            check_if_player_can_take_insurance(playing_positions);

            playing_positions.mark_cards_as_dealt();

            playing_positions.update_active_hand();
        }
        public void perform_on(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions);

            deal_two_cards_to_each_hand_in(playing_positions, card_shoe);

            update_the_status_of_each_hand_in(playing_positions);

            if (playing_positions.player_has_blackjack())
            {
                _annouce_winner_action.determine_winner_from(playing_positions, player);
            }

            check_if_player_can_double_down(playing_positions);

            check_if_player_can_split(playing_positions);

            check_if_player_can_take_insurance(playing_positions);

            playing_positions.mark_cards_as_dealt();

            playing_positions.update_active_hand();
        }
Example #20
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            playing_positions.players_active_hand.change_state_to(HandStatus.stick);
        }
Example #21
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            playing_positions.players_active_hand.change_state_to(HandStatus.stick);            
        }
Example #22
0
 public abstract void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player);
 protected BlackjackDealer(string name, IHand hand, ICardShoe cards)
     : base(name, hand)
 {
     _cards = cards;
 }
Example #24
0
 public void play_dealers_hand(IPlayingPositions hands, ICardShoe card_shoe, IPlayer player)
 {
     _play_dealers_hand.draw_cards_for_dealer_in(hands, card_shoe);
     _annouce_winner_action.determine_winner_from(hands, player);
 }
Example #25
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);

            playing_positions.players_active_hand.add(card_shoe.take_card());
        }
 protected BlackjackDealer(string name, ICardShoe cards)
     : this(name, new Hand(), cards)
 {
 }
 public void play_dealers_hand(IPlayingPositions hands, ICardShoe card_shoe, IPlayer player)
 {            
     _play_dealers_hand.draw_cards_for_dealer_in(hands, card_shoe);
     _annouce_winner_action.determine_winner_from(hands, player);                   
 }
 public abstract void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player);
 protected static Mock<BlackjackDealer> CreateDealer(IHand hand = null, ICardShoe shoe = null)
 {
     return new Mock<BlackjackDealer>("DEALER1", hand ?? new Hand(), shoe ?? Deckpile.Default) { CallBase = true };
 }
Example #30
0
 private GUIDealer(string name, ICardShoe cards)
     : base(name, cards)
 {
 }
Example #31
0
        public override void action_to_perform(IPlayingPositions playing_positions, ICardShoe card_shoe, IPlayer player)
        {
            raise_illegal_move_if_action_cannot_be_made_on(playing_positions, player);            

            playing_positions.players_active_hand.add(card_shoe.take_card());            
        }