diff --git a/.github/workflows/emulations.yaml b/.github/workflows/emulations.yaml new file mode 100644 index 0000000..46ee03c --- /dev/null +++ b/.github/workflows/emulations.yaml @@ -0,0 +1,24 @@ +name: Number of emulations + +on: + push: + branches: + - main + +jobs: + run_emulations: + runs-on: ubuntu-latest + strategy: + matrix: + pack: ["packs/elements.csv","packs/mcdonalds-baby-animals.csv","packs/the-art-game.csv"] + emulations: [10000, 100000, 1000000] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Run emulations + run: | + python top_trumps.py --pack ${{ matrix.pack }} --emulations ${{ matrix.emulations }} diff --git a/.github/workflows/packs.yaml b/.github/workflows/packs.yaml new file mode 100644 index 0000000..0ed5143 --- /dev/null +++ b/.github/workflows/packs.yaml @@ -0,0 +1,23 @@ +name: Packs + +on: + push: + branches: + - main + +jobs: + run_emulations: + runs-on: ubuntu-latest + strategy: + matrix: + pack: ["packs/cats.csv","packs/elements.csv","packs/famous-art-robberies.csv","packs/harry-potter-and-the-deathly-hallows-part-2.csv","packs/mcdonalds-baby-animals.csv","packs/mcdonalds-minions-rise-of-gru.csv","packs/star-wars-rise-of-the-bounty-hunters.csv","packs/star-wars-starships.csv","packs/the-art-game.csv","packs/the-big-bang-theory.csv"] # ls -1 packs/*.csv | jq -Rsc 'split("\n")[:-1]' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Run emulations + run: | + python top_trumps.py --pack ${{ matrix.pack }} diff --git a/.github/workflows/players.yaml b/.github/workflows/players.yaml new file mode 100644 index 0000000..d4bd1ba --- /dev/null +++ b/.github/workflows/players.yaml @@ -0,0 +1,24 @@ +name: Number of players + +on: + push: + branches: + - main + +jobs: + run_emulations: + runs-on: ubuntu-latest + strategy: + matrix: + pack: ["packs/elements.csv","packs/mcdonalds-baby-animals.csv","packs/the-art-game.csv"] + players: [2, 3, 5, 7, 10] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Run emulations + run: | + python top_trumps.py --pack ${{ matrix.pack }} --number_of_players ${{ matrix.players }} diff --git a/.github/workflows/strategies.yaml b/.github/workflows/strategies.yaml new file mode 100644 index 0000000..d5e1c6c --- /dev/null +++ b/.github/workflows/strategies.yaml @@ -0,0 +1,24 @@ +name: Strategies + +on: + push: + branches: + - main + +jobs: + run_emulations: + runs-on: ubuntu-latest + strategy: + matrix: + pack: ["packs/elements.csv","packs/mcdonalds-baby-animals.csv","packs/the-art-game.csv"] + strategy: ['get_highest_stat_index', 'get_random_stat_index'] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Run emulations + run: | + python top_trumps.py --pack ${{ matrix.pack }} --get_stat_index_method ${{ matrix.strategy }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3455034..3591be7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,9 +1,6 @@ name: Test on: - push: - branches: - - main pull_request: branches: - main diff --git a/README.md b/README.md index f52938d..c16e4ee 100644 --- a/README.md +++ b/README.md @@ -10,34 +10,34 @@ Wikipedia states that the playing time is 3-10 minutes. But is it, though? ## So, what is the real playtime? -The playtime for the decks from McDonald's should be quite predictable, even for the very first game, since their stats are always between 1 and 10, averaging about `35 minutes`. +The playtime for the packs from McDonald's should be quite predictable, even for the very first game, since their stats are always between 1 and 10. Based on emulations, the average playtime is about [`35 minutes`](https://github.com/aelmekeev/top-trumps/actions/workflows/packs.yaml). -The classic decks are a bit more tricky as stats values may vary significantly - year, height, price, etc. I need to gather some examples before sharing any number here. +The classic packs are a bit more complex, as the values of their stats can vary significantly — including year, height, price, etc. It may take a few games to determine what should be considered a "high" value for each stat, but otherwise, the gameplay doesn't differ much. Nonetheless, the classic packs show more variability in terms of playtime, ranging from [`34 to 56 minutes`](https://github.com/aelmekeev/top-trumps/actions/workflows/packs.yaml). In the first few games, where players might choose stats nearly at random, [the duration of the game can be reduced by up to 20%](https://github.com/aelmekeev/top-trumps/actions/workflows/strategies.yaml). -What if each player selects a stat at random during their turn? The playtime still averages `26-30 minutes`. +As evident, none of these durations come close to the 3-10 minutes mentioned on Wikipedia. ## Test conditions * Games emulated - `10,000` - * With this number, the average game duration deviates within ~2%. + * With this number, [the average game duration deviates within ~2%](https://github.com/aelmekeev/top-trumps/actions/workflows/emulations.yaml). * Number of players - `3` - * The average playtime decreases as more players join. + * The average playtime [decreases as more players join](https://github.com/aelmekeev/top-trumps/actions/workflows/players.yaml). * Average number of seconds per exchange - `8` * Based on tests conducted with the 7 years old. * Max exchanges - `450` * The assumption here is that after an hour, hardly anyone would want to continue playing the game. -Tests were run with the decks from `decks`. +Tests were run with the packs from `packs`. ## Other observations -### Are the stats identical between decks? +### Are the stats identical between packs? -It appears that all the decks have unique cards in terms of stats, even the ones from McDonald's Happy Meals. +It appears that all the packs have unique cards in terms of stats, even the ones from McDonald's Happy Meals. ### Identical cards -Some decks contain cards that are identical in terms of stats, for example: +Some packs contain cards that are identical in terms of stats, for example: * McDonald's Minions: Rise of Gru - `Jean-Clawed` and `Svengeance` ### Unusual stats