summaryrefslogtreecommitdiffstats
path: root/src/card.py
blob: 9f888e68183f884dff1946f33e1beb7bb8baa877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
"""
Defines a struct representing a single card. The struct takes the form:

(front, back)
"""

from collections import namedtuple
from hashlib import md5

Card = namedtuple('Card', ['front', 'back'])

def getId(card: Card) -> int:
    return int(md5((card.front + card.back).encode("utf-8")).hexdigest(), 16)