Esempio n. 1
0
def preprocess(args):
    raw_cards = []
    for clist in data.load().values():
        raw_cards.extend(clist)
    numcards = len(raw_cards)
    for rc in raw_cards:
        _ = card.Card.from_string(rc)
    cards = card.get_cards()
    split = {c.name for c in cards if c.multitype == "split"}
    xsplit = {c.multicard for c in cards if c.multitype == "split"}
    logging.debug("Split cards: " + "; ".join(sorted(split)))
    if split != xsplit:
        logging.error("Difference: " + "; ".join(split ^ xsplit))
    flip = {c.name for c in cards if c.multitype == "flip"}
    xflip = {c.multicard for c in cards if c.multitype == "flip"}
    logging.debug("Flip cards: " + "; ".join(sorted(flip)))
    if flip != xflip:
        logging.error("Difference: " + "; ".join(flip ^ xflip))
    trans = {c.name for c in cards if c.multitype == "transform"}
    xtrans = {c.multicard for c in cards if c.multitype == "transform"}
    logging.debug("Transform cards: " + "; ".join(sorted(trans)))
    if trans != xtrans:
        logging.error("Difference: " + "; ".join(trans ^ xtrans))
    s = int(len(split) / 2)
    f = int(len(flip) / 2)
    t = int(len(trans) / 2)
    logging.info("Discovered {} unique (physical) cards, from {}, including "
                 "{} split cards, {} flip cards, and {} transform cards."
                 .format(len(cards) - s - f - t, numcards, s, f, t))
    legalcards = get_cards()
    logging.info("Found {} banned cards.".format(len(cards) - len(legalcards)))
    if len(cards) - len(legalcards) != len(BANNED):
        logging.warning("...but {} banned cards were named."
                        .format(len(BANNED)))
    card.preprocess_all(legalcards)
    if args.interactive:
        import code
        code.interact(local=globals())
Esempio n. 2
0
def get_cards():
    return [c for c in card.get_cards() if c.name not in BANNED]
Esempio n. 3
0
import telebot
Esempio n. 4
0
def get_cards():
    return [c for c in card.get_cards() if c.name not in BANNED]