# Tarot Spread Program 0.0.2 # Copyright 2003 Lja MultiMedia # May be used under the GNU GPL """Displays a tarot spread or poker hand.""" # --- Config Section --- MODE = 'tarot' # The options are 'tarot' or 'poker' # --- Mode Setup Sectrion --- SUIT_CARD = 'The %s of %s' SUITES_FRENCH = 'Spades', 'Clubs', 'Diamonds', 'Hearts' SUITES_ITALIAN = 'Swords', 'Staffs', 'Coins', 'Cups' RANKS_NUMBERS = 'Ace', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten' RANKS_COURTS_FRENCH = 'Jack', 'Queen', 'King' RANKS_COURTS_ITALIAN = 'Squire', 'Knight', 'King' RANKS_COURTS_TAROT = 'Lady', 'Knight', 'Queen', 'King' TRUMPS_POKER = 'The High Joker', 'The Low Joker' TRUMPS_TAROT = 'The Fool', 'The Mage', 'The Preistess', 'The Empress', 'The Emporer',\ 'The Preist', 'The Lovers', 'The Chariot', 'Fortitude', 'The Hermit', 'The Wheel of Fortune',\ 'Justice', 'The Hanged Man', 'Death', 'Temperence', 'The Devil', 'The Tower Struck',\ 'The Star', 'The Moon', 'The Sun', 'The Angle', 'The Universe' if MODE == 'poker': SUITS = SUITES_FRENCH RANKS = RANKS_NUMBERS + RANKS_COURTS_FRENCH TRUMPS = TRUMPS_POKER HAND_SIZE = 5 elif MODE == 'tarot': SUITS = SUITES_ITALIAN RANKS = RANKS_NUMBERS + RANKS_COURTS_TAROT TRUMPS = TRUMPS_TAROT HAND_SIZE = 3 else: import sys print 'Unknown MODE:' + str(MODE) sys.exit(42) # --- Code Section --- import random def main(): deck = [] for suit in SUITS: for rank in RANKS: deck.append((rank, suit)) for trump in TRUMPS: deck.append((trump, 'trump')) spare = deck[:] for i in range(HAND_SIZE): card = random.choice(spare) spare.remove(card) if card[1] == 'trump': print card[0] else: print SUIT_CARD % card if __name__ == '__main__': main()