Skip to main content

Mighty card game engine

Project description

Mighty Engine

Example

game = PledgePhase(start_player=0, min_count=13)
while not game.pledge_done():
    print('Boss: {}\tShape: {}\tCount: {}'.format(*game.current_pledge()))
    print('queue: {}'.format(game.pledge_queue))
    player = game.turn_player()
    print('Player {}: {}'.format(player, game.hand(player=player)))

    pledge_until_valid(game)

if game.boss is not None:
    game = ExtraPhase(*game.pledge_result())
    game.prepare_extra_hand()
    boss = game.boss
    hand = game.hand(player=boss)
    print('Boss extra hand: {}'.format(hand))
    discard = list(map(int, input('Discard: ').split()))
    game.discard_extra(discard=discard)
    friend_condition = input('Pick friend: ')
    game.pick_friend(friend_condition)

    game = PlayPhase(*game.extra_result())
    for r in range(10):
        print('Round {}'.format(r))
        for _ in range(game.NUM_PLAYERS):
            print(game.round_state())
            player = game.turn_player()
            hand = game.hand(player=player)
            print(hand)
            while True:
                card = int(input('Card: '))
                valid, actions = game.check_submit(card=card)
                if not valid:
                    continue
                elif actions:
                    print(actions)
                    action = actions[int(input())]
                    game.submit(card=card, action=action)
                else:
                    game.submit(card=card, action=None)
                break
            print(game.submitted_cards())
        print(game.round_summary())
    print(game.final_summary())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mighty-1.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

mighty-1.0.1-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page