In [22]:
from game.pile import Pile
from game.player import Player
from game.deck import Deck
from random import choice

%load_ext autoreload
%autoreload 2


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [45]:
deck = Deck()
deck.shuffle()

# Print for diagnostic purposes only.
# print('The deck has {0} cards.'.format(len(deck.cards)))

chameleon = 7
c = choice(deck.cards)
deck.cards.remove(c)
pile = Pile(chameleon, c)
p1 = Player(chameleon)
p2 = Player(chameleon)

for i in range(0,5):
    # print('The deck has {0} cards.'.format(len(deck.cards)))
    p1.take_card(deck)
    p2.take_card(deck)
    
# print("Player 1's hand: {0}".format(p1.hand))
# print("Player 2's hand: {0}".format(p2.hand))

In [47]:
while p1.has_cards() or p2.has_cards():
    # print('Player 1 has {0} cards.'.format(len(p1.hand)))
    # print('Player 2 has {0} cards.'.format(len(p2.hand)))
    # print('---')
    # print('Current card is {0} of {1}.'.format(pile.current_value, pile.current_suite))
    p1.deal(pile)
    p1.take_card(deck)
    p2.deal(pile)
    p2.take_card(deck)

In [48]:
p1.has_chameleon(), p1.has_joker(), p1.hand


Out[48]:
(False, False, [])

In [49]:
p2.has_chameleon(), p2.has_joker(), p2.hand


Out[49]:
(False, False, [])

In [50]:
deck.cards


Out[50]:
[]

In [51]:
p1.penalty_score()


Out[51]:
47

In [52]:
p1.penalty


Out[52]:
[Card(suite='spades', value=5),
 Card(suite='clubs', value=6),
 Card(suite='hearts', value=6),
 Card(suite='hearts', value=1),
 Card(suite='diamonds', value=5),
 Card(suite='spades', value=1),
 Card(suite='hearts', value=5),
 Card(suite='hearts', value=3),
 Card(suite='clubs', value=5),
 Card(suite='clubs', value=10)]

In [53]:
p2.penalty_score()


Out[53]:
10

In [54]:
p2.hand


Out[54]:
[]

In [43]:
p1.hand


Out[43]:
[]

In [44]:
len(deck.cards)


Out[44]:
0

In [ ]:


In [ ]:


In [ ]: