Skip to content

Instantly share code, notes, and snippets.

@jefflunt
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefflunt/d535445d1f12f07339e5 to your computer and use it in GitHub Desktop.
Save jefflunt/d535445d1f12f07339e5 to your computer and use it in GitHub Desktop.
"""
The FooBar Card Game!
The game is simple:
1. Start a deck of cards
2. Shuffle the deck
3. Every player has a "hand" - a list of cards they are holding
4. Deal all cards from the deck as evenly as possible to all players
5. Score the cards - the player with the highest score WINS!"
6. Jokers are optional
Scoring:
Cards 2-9 : 5 points
Cards Jack-King: 10 points
Aces : 15 points
Jokers : -5 points
Output:
Print each player, and their score, and their hand (list of cards)
"""
# Deck of cards stuff
# ===================
PLAIN_DECK = (
'As', 'Ac', 'Ad', 'Ah',
'1s', '1c', '1d', '1h',
'2s', '2c', '2d', '2h',
'3s', '3c', '3d', '3h',
'4s', '4c', '4d', '4h',
'5s', '5c', '5d', '5h',
'6s', '6c', '6d', '6h',
'7s', '7c', '7d', '7h',
'8s', '8c', '8d', '8h',
'9s', '9c', '9d', '9h',
'Js', 'Jc', 'Jd', 'Jh',
'Qs', 'Qc', 'Qd', 'Qh',
'Ks', 'Kc', 'Kd', 'Kh'
)
JOKERS = ('Jk', 'Jk')
players = [
{'name': 'Jeff', 'hand': []},
{'name': 'Kyle', 'hand': []},
{'name': 'Mark', 'hand': []},
{'name': 'Adam', 'hand': []}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment