59 lines
1.1 KiB
Python
59 lines
1.1 KiB
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import argparse
|
||
|
import pprint
|
||
|
import sys
|
||
|
import typing
|
||
|
|
||
|
import cards
|
||
|
|
||
|
|
||
|
class Player:
|
||
|
hand: typing.Set[cards.Card]
|
||
|
captured: typing.Set[cards.Card]
|
||
|
|
||
|
@property
|
||
|
def score(self):
|
||
|
return len(self.captured)
|
||
|
|
||
|
|
||
|
def main():
|
||
|
parser = argparse.ArgumentParser(
|
||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
||
|
)
|
||
|
parser.add_argument(
|
||
|
"--player-count", "-c", default=2, type=int, help="The number of players"
|
||
|
)
|
||
|
parser.add_argument(
|
||
|
"--turn-count",
|
||
|
"-n",
|
||
|
default=5,
|
||
|
type=int,
|
||
|
help="The number of turns to play",
|
||
|
)
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
for turn in _simulate_game(
|
||
|
player_count=args.player_count, turn_count=args.turn_count
|
||
|
):
|
||
|
_show_turn(turn)
|
||
|
|
||
|
return 0
|
||
|
|
||
|
|
||
|
def _simulate_game(player_count=2, turn_count=5):
|
||
|
for turn in range(turn_count):
|
||
|
yield _simulate_turn(player_count=player_count)
|
||
|
|
||
|
|
||
|
def _simulate_turn(player_count=2):
|
||
|
...
|
||
|
|
||
|
|
||
|
def _show_turn(turn):
|
||
|
...
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
sys.exit(main())
|