def __init__(self, grid): self.img, self.rect = media.load_png("Candleman.png") self.name = "Tim" self.Px = 0 # Indice de su ubicación en el mapa self.Py = 0 self.deck = cards.deck(10) grid.putinmiddle(self, (self.Px, self.Py))
def new_hand(self): self.deck = cards.deck() self.open_cards = [] self.last_bet = [] self.pot = 0 for player in self.players: player.reset_state()
def test_deck_shuffle_duplicates(): test_deck = cards.deck() test_deck.shuffle() # are there any duplicates? for i in standard_deck: assert test_deck.count(i) == 1
def __init__(self): self.deck = cards.deck() self.open_cards = [] self.players = [] self.bank = 0 self.s_blind = 2 # small blind money value self.b_blind = 4 # big blind money value self.blinds = {'small': None, 'big': None} # blind player indices
def test_deck_deal_5_1(): test_deck = cards.deck() test_hand = {'Mikey': set()} test_deck.deal_cards(test_hand, 5) assert len(test_hand['Mikey']) + test_deck.cards_remaining == 54 for card in test_hand['Mikey']: assert card not in test_deck
def test_cards(): deck = cards.deck() deck.shuffle() deck.read_deck() print("Dealing ... ") deck.deal_card_to("player1") deck.deal_card_to("player2") print("Done Dealing ...") deck.read_top_cards(5)
def __init__(self, small=2, big=4): self.deck = cards.deck() self.open_cards = [] self.players = [] self.pot = 0 self.small_blind = int(small) self.big_blind = int(big) self.blinds = {'small': None, 'big': None} self.last_bet = []
def test_deck_deal_5_to_5(): test_deck = cards.deck() test_game = { "Greg": set(), "Theo": set(), "Marcus": set(), "Jane": set(), "Hilda": set() } test_deck.deal_cards(test_game, 5) dealt_sum = 0 for hand in test_game.values(): dealt_sum += len(hand) assert dealt_sum + test_deck.cards_remaining == 54 game_copy = test_game.copy() for name, hand in test_game.items(): for k, v in game_copy.items(): if name != k: assert len(hand.intersection(v)) == 0 assert len(hand.intersection(set(test_deck))) == 0
def test_pair(self): card = cards.deck() for a in card: print a score = bscore.pair(a,a)
def test_shuffle(self): d = cards.deck() self.assertNotEqual(d.shuffle,d.shuffle(2))
def __init__(self, deckCount=1): self.deck = cards.deck(deckCount) self.deck.shuffle()
def test_deck_creation(self): """ Test that a deck of the correct length can be created successfully """ self.assertEqual(len(deck().get_all_card_objects()), 52)
def test_deck_draw_1(): test_deck = cards.deck() hand = test_deck.draw_card() assert len(hand) + len(test_deck) == 54 assert hand.pop() not in test_deck
def test_deck_shuffle_qty(): test_deck = cards.deck() test_deck.shuffle() # did the shuffle change the number of cards? assert len(test_deck) == test_deck.cards_remaining == 54
def test_deck_build_order(): test_deck = cards.deck() for l, r in zip(test_deck, standard_deck): assert l == r
def test_deck_build(): # should always start with a full deck & Jokers (54) test_deck = cards.deck() assert len(test_deck) == test_deck.cards_remaining == 54
def test_cards_in_deck_are_unique(self): """ Test that the cards generated within a deck are unique """ self.assertEqual(len(set(deck().get_all_card_objects())), 52)
def take_new_deck(self): self.deck = cards.deck() self.open_cards = [] for p in self.players: p.reset_state()
dealer_hand[0]), " total:", dealerpoint[0][0] return dealerpoint #This function takes in the number of players and account (which is a list). It is used after the for loop is run 3 times. It prints out each player final amount of money after 3 rounds. def show_final_money(players, account): for i in range(players): print "Player #" + str(i + 1) + ":", "$" + str(account[i][0]) players = player() account = account(players) for i in range(3): import cards import random deck = cards.deck() random.shuffle(deck) dealer_hand = dealerhand() players_hand = playershand(players, deck) bet = makebet(players, account) show_initial_hand(dealer_hand, players_hand, players) dealerpoint = readpoint(dealer_hand) playerspoint = readpoint(players_hand) playerspoint = players_turn(players_hand, players, playerspoint) dealerpoint = dealer_turn(dealer_hand, dealerpoint) result_list = result(playerspoint, dealerpoint) account = arrangemoney(result_list, account, bet) show_result(players, result_list, bet) x = raw_input("Press enter to continue.") print "\n" * 2
def test_deck_draw_5(): test_deck = cards.deck() hand = test_deck.draw_card(5) assert len(hand) + test_deck.cards_remaining == 54 for card in hand: assert card not in test_deck