Skip to content

Commit

Permalink
Merge pull request #79 from evanofslack/release
Browse files Browse the repository at this point in the history
Fix circular import bug in v0.2.0 release
  • Loading branch information
evanofslack authored Dec 5, 2021
2 parents 0de272a + 8c3a7d5 commit 312b08f
Show file tree
Hide file tree
Showing 27 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[run]
omit = *tests*, pyminion/bots/examples*
omit = tests*, pyminion/bots/examples*

[report]
exclude_lines =
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To play an interactive game through the command line against a bot, initialize a
```python
from pyminion.expansions.base import base_cards
from pyminion.game import Game
from pyminion.bots import BigMoney
from pyminion.bots.examples import BigMoney
from pyminion.players import Human

# Initialize human and bot
Expand All @@ -51,7 +51,7 @@ Defining new bots is relatively straightforward. Inherit from the `Bot` class an
For example, here is a simple big money + smithy bot:

```python
from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.game import Game
from pyminion.expansions.base import silver, gold, province, smithy

Expand Down
2 changes: 1 addition & 1 deletion examples/bot_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from pyminion.bots import BigMoney, BigMoneyUltimate
from pyminion.bots.examples import BigMoney, BigMoneyUltimate
from pyminion.expansions.base import base_cards, smithy
from pyminion.game import Game

Expand Down
2 changes: 1 addition & 1 deletion examples/human_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Play a game through the terminal. Either by yourself, with another human, or against a bot.
"""
from pyminion.bots import BigMoney
from pyminion.bots.examples import BigMoney
from pyminion.expansions.base import base_cards
from pyminion.game import Game
from pyminion.players import Human
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Simulate multiple games between two or more bots.
"""
from pyminion.bots import BigMoney, BigMoneySmithy
from pyminion.bots.examples import BigMoney, BigMoneySmithy
from pyminion.expansions.base import base_cards, smithy
from pyminion.game import Game
from pyminion.simulator import Simulator
Expand Down
2 changes: 1 addition & 1 deletion pyminion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.0"
__version__ = "0.2.1"
__author__ = "Evan Slack"


Expand Down
8 changes: 4 additions & 4 deletions pyminion/bots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Pyminion provides a couple of different base classes that can be used to implement new bots. The goal is to provide a convenient starting point from which new bots can be built.
## `Bot`

The first class that can be used is `Bot` found in `base_bot.py`. While this class is capable of playing any card in the base set of Dominion, cards that require logical input are not optimized.
The first class that can be used is `Bot` found in `bot.py`. While this class is capable of playing any card in the base set of Dominion, cards that require logical input are not optimized.

For example, this card can technically play chapel, but it would choose not to trash any cards. Similarly, when facing a discard attack from militia, this bot would just discard the first few cards in its hand.

When inheriting from this class, it is only necessary to overwrite the `action_priority` and `buy_priority` methods. This is an example of a bot created from `Bot`:

```python
from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.game import Game
from pyminion.expansions.base import silver, gold, province, smithy

Expand Down Expand Up @@ -46,7 +46,7 @@ Again, when inheriting from this class, it is only necessary to overwrite the `a
For example, here is a bot based on `OptimizedBot that will buy and play Workshop:

```python
from pyminion.bots import OptimizedBot
from pyminion.bots.optimized_bot import OptimizedBot
from pyminion.core import Card
from pyminion.expansions.base import workshop, duchy, estate, gold, province, silver
from pyminion.game import Game
Expand Down Expand Up @@ -80,7 +80,7 @@ class WorkshopBot(OptimizedBot):
yield silver
```

OptimizedBot already defines a method for how Workshop will be played:
`OptimizedBot` already defines a method for how Workshop will be played:

```python
def workshop(self, game: "Game") -> Card:
Expand Down
13 changes: 0 additions & 13 deletions pyminion/bots/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
from pyminion.bots.base_bot import Bot
from pyminion.bots.optimized_bot import OptimizedBot

placeholder = (
"This keeps isort from moving specific bots above the dependent 'Bot' import"
)

# Specific Bot Implementations
from pyminion.bots.examples.bandit_bot import BanditBot
from pyminion.bots.examples.big_money import BigMoney
from pyminion.bots.examples.big_money_smithy import BigMoneySmithy
from pyminion.bots.examples.big_money_ultimate import BigMoneyUltimate
from pyminion.bots.examples.chapel_bot import ChapelBot
File renamed without changes.
6 changes: 6 additions & 0 deletions pyminion/bots/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Specific Bot Implementations
from pyminion.bots.examples.bandit_bot import BanditBot
from pyminion.bots.examples.big_money import BigMoney
from pyminion.bots.examples.big_money_smithy import BigMoneySmithy
from pyminion.bots.examples.big_money_ultimate import BigMoneyUltimate
from pyminion.bots.examples.chapel_bot import ChapelBot
4 changes: 2 additions & 2 deletions pyminion/bots/examples/bandit_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Iterator

from pyminion.bots import Bot
from pyminion.bots.optimized_bot import OptimizedBot
from pyminion.core import Card
from pyminion.expansions.base import (
bandit,
Expand All @@ -17,7 +17,7 @@
logger = logging.getLogger()


class BanditBot(Bot):
class BanditBot(OptimizedBot):
"""
Attempt the following buys in order:
Expand Down
2 changes: 1 addition & 1 deletion pyminion/bots/examples/big_money.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Iterator

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.core import Card
from pyminion.expansions.base import gold, province, silver
from pyminion.game import Game
Expand Down
2 changes: 1 addition & 1 deletion pyminion/bots/examples/big_money_smithy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.expansions.base import gold, province, silver, smithy
from pyminion.game import Game

Expand Down
2 changes: 1 addition & 1 deletion pyminion/bots/examples/big_money_ultimate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Iterator

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.core import Card
from pyminion.expansions.base import duchy, estate, gold, province, silver, smithy
from pyminion.game import Game
Expand Down
2 changes: 1 addition & 1 deletion pyminion/bots/examples/chapel_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Iterator

from pyminion.bots import OptimizedBot
from pyminion.bots.optimized_bot import OptimizedBot
from pyminion.core import Card
from pyminion.expansions.base import chapel, duchy, estate, gold, province, silver
from pyminion.game import Game
Expand Down
2 changes: 1 addition & 1 deletion pyminion/bots/optimized_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import TYPE_CHECKING, List, Optional

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.core import Card
from pyminion.expansions.base import duchy, estate, silver
from pyminion.players import Player
Expand Down
2 changes: 1 addition & 1 deletion pyminion/expansions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
from typing import TYPE_CHECKING, List, Optional, Tuple, Union

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.core import AbstractDeck, Action, Card, Treasure, Victory
from pyminion.decisions import validate_input
from pyminion.exceptions import InvalidMultiCardInput, InvalidSingleCardInput
Expand Down
2 changes: 1 addition & 1 deletion pyminion/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from typing import List, Union

from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.game import Game
from pyminion.players import Human, Player

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pyminion",
version="0.2.0",
version="0.2.1",
author="Evan Slack",
author_email="evan.slack@outlook.com",
description="Dominion but make it python",
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest
from pyminion.bots import BigMoney, Bot, OptimizedBot
from pyminion.bots.bot import Bot
from pyminion.bots.examples import BigMoney
from pyminion.bots.optimized_bot import OptimizedBot
from pyminion.core import Deck, Pile, Supply, Trash
from pyminion.expansions.base import (
base_cards,
Expand Down
9 changes: 0 additions & 9 deletions tests/test_core/test_bot.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from pyminion.bots import Bot
from pyminion.bots.bot import Bot
from pyminion.expansions.base import copper, estate, gold
from pyminion.game import Game

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyminion.bots import BigMoney, BigMoneyUltimate
from pyminion.bots.examples import BigMoney, BigMoneyUltimate
from pyminion.expansions.base import base_cards, smithy
from pyminion.game import Game

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyminion.bots import OptimizedBot
from pyminion.bots.optimized_bot import OptimizedBot
from pyminion.expansions.base import (
artisan,
bureaucrat,
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions tests/test_simulator/test_simulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from pyminion.bots.examples import BigMoney, BigMoneyUltimate
from pyminion.expansions.base import base_cards, smithy
from pyminion.game import Game
from pyminion.simulator import Simulator


def test_sim():
bm = BigMoney()
bm_ultimate = BigMoneyUltimate()
game = Game(
players=[bm, bm_ultimate], expansions=[base_cards], kingdom_cards=[smithy]
)
sim = Simulator(game, iterations=2)
sim.run()

0 comments on commit 312b08f

Please sign in to comment.