예제 #1
0
def main():

    deck = Deck()
    #print(deck)
    deck.shuffle()
    player_hand = Hand()
    for i in range(1, 5):
        print(player_hand.add_card(deck.pick_card()).number.value)
    print(player_hand.count())
예제 #2
0
    clear()
    # Show some niceties the first time
    if command == 'first_run':
        f = Figlet(font='big', width=100)
        print(
            f'{Fore.BLUE}{f.renderText("Cribbage")}{Style.RESET_ALL}')
        print(f'{Fore.RED}{f.renderText("Counting")}{Style.RESET_ALL}')
        print(f'{Fore.LIGHTGREEN_EX}{f.renderText("Demo")}{Style.RESET_ALL}')
        command = get_command()
    if command == 'c':
        hand = get_custom_hand()
    elif command == 'q':
        break
    else:
        # Create and shuffle a deck to get a random hand
        deck = Deck()
        deck.shuffle()
        # Deal four cards to the hand and one to the upcard
        hand = Hand(deck.deal_card(4))
        hand.upcard = deck.deal_card(1)[0]
    clear()
    print('Hand cards: ')
    print(Score(hand.cards, 0))
    print('Cut card: ')
    print(hand.upcard)
    print('All cards:')
    print(hand, '\n***************\n')
    hand.count(True)
    hand = Hand()
    command = get_command()