Here is the script I had for Crown card game, it's less worked out than I
remembered so there's not much to it but the idea is nice I think. I'd have to
make graphics the other red and green suits for the cards...I think I'd just
add a stripe of colour on the top and bottom opposing corners - that would look
nice.
import random
class CrownDeck:
def __init__(self):
'''Generates a Deck of 47 cards (15 of the white, red and green suits and two skulls).
There are many games that can be played with the Crown deck - the simplest being
'Crown' or 'Little Prince'.
In 'Crown' the places an initial bet on the table and the dealer matches this bet.
Then the player and the dealer are each dealt out a number of cards (usually 4 or 5)
one face up and the rest face down. The player then places another bet equal to the first
to turn over an additional card. The dealer follows. This continues until the player wins or yields.
The dealer cannot yield however a tied score goes to the dealer.
Crown Deck is based on narative and the value of the cards is based on their frequency
In some games (such as in 'Kings Cross') Skulls are wild but in most games they are a
penalty card of some sort.'''
# First the cards:
cards = {'Crown' : 1, 'Dragon' : 2, 'Sword' : 3, 'Ring' : 4, 'Cup' : 5}
#The three suits:
suits = ['White', 'Red', 'Green']
#The Skull is bad, it's value will be the negative of the value of the Crown
skull = ('Black', 'Skull', -5)
self.deck = []
for suit in suits:
for item in cards:
x = range(0,cards[item])
for number in x:
self.deck.append((suit, item,(len(cards)-cards[item] +1)))
#add Two Skulls
self.deck.append(skull)
self.deck.append(skull)
def deal(self, number):
random.shuffle(self.deck)
hand = []
total = 0
x = range(0,number)
for item in x:
hand.append(self.deck.pop())
return hand
def tally(self, hand):
total = 0
for item in hand:
print "%s %s is worth %d" % (item[0],item[1],item[2])
total = total + item[2]
print ""
print "This hand is worth %d" %total
return total
if __name__ == '__main__':
# Test Game deals out 4 cards
deck = CrownDeck()
cards = 8
deal = deck.deal(cards)
hand1 = deal[:(cards/2)]
hand2 = deal[(cards/2):]
print "Your Hand"
print hand1
print "My Hand"
print hand2
print ""
total = deck.tally(hand1)
print ""
total2 = deck.tally(hand2)
if total > total2:
print "You Win!"
else:
print "You Loose"
_______________________________________________
crossfire mailing list
[email protected]
http://mailman.metalforge.org/mailman/listinfo/crossfire