예제 #1
0
 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))
예제 #2
0
 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()
예제 #3
0
	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()
예제 #4
0
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
예제 #5
0
파일: poker.py 프로젝트: deskov/pythonpoker
	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
예제 #6
0
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
예제 #7
0
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)
예제 #8
0
 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 = []
예제 #9
0
	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		= []
예제 #10
0
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
예제 #11
0
 def test_pair(self):
     card = cards.deck()
     for a in card:
         print a
         score = bscore.pair(a,a)
예제 #12
0
파일: test.py 프로젝트: r0fls/poker
 def test_shuffle(self):
     d = cards.deck()
     self.assertNotEqual(d.shuffle,d.shuffle(2))
예제 #13
0
 def __init__(self, deckCount=1):
     self.deck = cards.deck(deckCount)
     self.deck.shuffle()
예제 #14
0
 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)
예제 #15
0
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
예제 #16
0
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
예제 #17
0
def test_deck_build_order():
    test_deck = cards.deck()
    for l, r in zip(test_deck, standard_deck):
        assert l == r
예제 #18
0
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
예제 #19
0
 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)
예제 #20
0
파일: poker.py 프로젝트: deskov/pythonpoker
	def take_new_deck(self):
		self.deck = cards.deck()
		self.open_cards = []
		for p in self.players:
			p.reset_state()
예제 #21
0
        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
예제 #22
0
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