#!/usr/bin/env python3

import argparse
import dataclasses
import pprint
import sys
import typing

import cards


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

    Hyrule(player_count=args.player_count, turn_count=args.turn_count).play()
    return 0


@dataclasses.dataclass
class Player:
    index: int
    hand: typing.Set[cards.Card]
    captured: typing.Set[cards.Card]

    @property
    def score(self):
        return len(self.captured)


class Hyrule:
    def __init__(self, player_count=2, turn_count=5):
        self._players = [
            Player(index=i, hand=set(), captured=set()) for i in range(player_count)
        ]
        self._turn_count = turn_count

    def play(self):
        for turn in self._each_turn():
            self._show_turn(turn)

    def _each_turn(self):
        for turn_number in range(self._turn_count):
            yield self._simulate_turn(turn_number)

    def _simulate_turn(self, turn_number):
        ...

    def _show_turn(self, turn):
        print(turn)


if __name__ == "__main__":
    sys.exit(main())
