diff --git a/mydeck/core.py b/mydeck/core.py index 5d0aa6c..a41d18e 100644 --- a/mydeck/core.py +++ b/mydeck/core.py @@ -14,7 +14,7 @@ Card = collections.namedtuple("Card", ["rank", "suit"]) # %% ../nbs/05_deck.ipynb 9 -#| code-fold: true +# | code-fold: true class FrenchDeck: ranks = [n for n in range(1, 14)] suits = "spades diamonds clubs hearts".split() diff --git a/mydeck/utils.py b/mydeck/utils.py index 1f3ea92..faccb63 100644 --- a/mydeck/utils.py +++ b/mydeck/utils.py @@ -11,10 +11,12 @@ from mydeck.core import Card # %% ../nbs/06_hand.ipynb 3 -#| code-fold: true +# | code-fold: true class Hand: def __init__( - self, max_cards: Optional[int] = None # Max amount of cards it can be hold + # Max amount of cards it can be hold + self, + max_cards: Optional[int] = None, ): self._max_cards = max_cards self.cards: List[Card] = [] diff --git a/nbs/06_hand.ipynb b/nbs/06_hand.ipynb index e176ac2..aecc76a 100644 --- a/nbs/06_hand.ipynb +++ b/nbs/06_hand.ipynb @@ -137,13 +137,24 @@ "execution_count": null, "id": "8cabce32", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "Card(rank=1, suit='spades')" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#| exec_doc\n", "#| code-fold: false\n", "card = Card(rank=1, suit=\"spades\")\n", "\n", - "hand.draw(card)\n", + "hand.draw(card) # type: ignore\n", "hand" ] }, @@ -160,7 +171,18 @@ "execution_count": null, "id": "45aa3d73", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[Card(rank=1, suit='spades')]" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#| exec_doc\n", "[card for card in hand]" @@ -171,10 +193,21 @@ "execution_count": null, "id": "1b8584bd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "#| exec_doc\n", - "hand.discard()\n", + "hand.discard() # type: ignore\n", "len(hand)" ] },