Skip to content

Instantly share code, notes, and snippets.

@salmonmoose
Created June 27, 2012 02:34
Show Gist options
  • Save salmonmoose/3000972 to your computer and use it in GitHub Desktop.
Save salmonmoose/3000972 to your computer and use it in GitHub Desktop.
import random
suits = [
'Hearts',
'Diamonds',
'Clubs',
'Spades'
]
values = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King']
cards = [[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[0,12],[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10],[1,11],[1,12],[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7],[2,8],[2,9],[2,10],[2,11],[2,12],[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7],[3,8],[3,9],[3,10],[3,11],[3,12]]
def print_card(card):
print "%s of %s" % (values[card[1]], suits[card[0]])
if __name__ == '__main__':
random.shuffle(cards)
hands = [
[cards.pop() for dealt in range(2)]
for hand in range(6)
]
table = [
cards.pop() for dealt in range(5)
]
for key, value in enumerate(hands):
print "Hand %s" % (key+1)
for dealt in hands[key]:
print_card(dealt)
print "Table"
for dealt in table:
print_card(dealt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment