Ejemplo n.º 1
0
p1 = Player(b1)
print "Info of p1:"
print p1
p1.setID(3)
p1.setName("Shawn")
print "Info of p1:"
print p1
d1 = Deck()
print "Check if Hands of p1 is empty:"
if p1.handIsEmpty():
    print "Yes!"
else:
    print "No!"
print "Hands of p1 at the beginning"
p1.displayHands()
cd1 = d1.popCard()
p1.drawCard(cd1)
cd1 = d1.popCard()
p1.drawCard(cd1)
cd1 = d1.popCard()
p1.drawCard(cd1)
cd1 = d1.popCard()
p1.drawCard(cd1)
print "Hands of p1 after drawing for 4 times"
p1.displayHands()
print "\n\n"

################################################################################
#test declareTrump()
print "Test declareTrump()"
cdOnDesk = [[],[],[]]
Ejemplo n.º 2
0
d1.changeBottom(get,put,debug = 1)

#try to put 4 cards into the bottom while require other than 4
put = [Card(3),Card(5),Card(19),Card(33)]
d1.changeBottom(get,put,debug = 1)

#try to require some cards that are not in the bottom
d2 = Deck()
get = d2.getBottom()
get = get[0:4]
get[0] = Card(1)#this is probably not in the bottom
put = [Card(3),Card(5),Card(19),Card(33)]
d1.changeBottom(get,put,debug = 1)




#test Deck.popCard()
d3 = Deck()
top1 = d3.getTop()
print "How many cards are in the top?"
print d3.nRemaining()
card1 = d3.popCard()
top1 = d3.getTop()
print "How many cards are in the top?"
print d3.nRemaining()
card2 = d3.popCard()
top1 = d3.getTop()
print "How many cards are in the top?"
print d3.nRemaining()