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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file mighty-1.0.1.tar.gz.

File metadata

  • Download URL: mighty-1.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Linux/5.4.0-42-generic

File hashes

Hashes for mighty-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ea19bccb80c12c760ef5738ff575ac7c24086cb5291cb79257b08747ac3e12b1
MD5 7488df41de407a669e2f044b3ae960aa
BLAKE2b-256 e82daa8a6d3489813ff2c52d6c0ba9da4756195f041f1a093d562df11f1fad37

See more details on using hashes here.

File details

Details for the file mighty-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mighty-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Linux/5.4.0-42-generic

File hashes

Hashes for mighty-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73f8c5d8b5c70cefd774c9dd9d8326bc8de206b382fd327cf2500fed7978c0df
MD5 f52a5589921760f9db19280e80707877
BLAKE2b-256 0c072c5f72e956bd699afe720a6f6116bcc02279866ef02ce66fcd56cc75258b

See more details on using hashes here.

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