# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.

# %% auto 0
__all__ = ['rank_order', 'suit_order', 'card_pool', 'get_trump_round_rank', 'cards2ranks']

# %% ../nbs/00_core.ipynb 2
from fastcore.all import *
import numpy as np

# %% ../nbs/00_core.ipynb 3
rank_order = '4567qjka23'
suit_order = 'dshc'
card_pool = [f'{r}{s}' for r in rank_order for s in suit_order]

# %% ../nbs/00_core.ipynb 4
def get_trump_round_rank(faceup):
    trump = rank_order[(rank_order.find(faceup[0])+1)%len(rank_order)]
    round_order = rank_order.replace(trump, '') 
    trump_rank = {f'{trump}{s}': len(round_order)+i for i, s in enumerate(suit_order)}
    round_rank = {f'{r}{s}': i for i,r in enumerate(round_order) for s in suit_order}
    round_rank.update(trump_rank)
    return trump, round_rank

# %% ../nbs/00_core.ipynb 7
def cards2ranks(cards, round_rank): return np.array([round_rank[c] for c in cards])
