🐐
This commit is contained in:
@@ -90,6 +90,7 @@ class Card(NamedTuple):
|
||||
|
||||
WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q5": CardType.person, # human
|
||||
"Q95074": CardType.person, # character
|
||||
"Q215627": CardType.person, # person
|
||||
"Q15632617": CardType.person, # fictional human
|
||||
"Q22988604": CardType.person, # fictional human
|
||||
@@ -141,6 +142,7 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q23442": CardType.location, # island
|
||||
"Q82794": CardType.location, # geographic region
|
||||
"Q34442": CardType.location, # road
|
||||
"Q486972": CardType.location, # human settlement
|
||||
"Q192611": CardType.location, # electoral unit
|
||||
"Q398141": CardType.location, # school district
|
||||
"Q133056": CardType.location, # mountain pass
|
||||
@@ -149,6 +151,7 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q7930989": CardType.location, # city/town
|
||||
"Q1250464": CardType.location, # realm
|
||||
"Q3146899": CardType.location, # diocese of the catholic church
|
||||
"Q12076836": CardType.location, # administrative territorial entity of a single country
|
||||
"Q35145263": CardType.location, # natural geographic object
|
||||
"Q15642541": CardType.location, # human-geographic territorial entity
|
||||
|
||||
@@ -179,6 +182,7 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q13406554": CardType.event, # sports competition
|
||||
"Q15275719": CardType.event, # recurring event
|
||||
"Q27968055": CardType.event, # recurring event edition
|
||||
"Q15091377": CardType.event, # cycling race
|
||||
"Q114609228": CardType.event, # recurring sporting event
|
||||
|
||||
"Q7278": CardType.group, # political party
|
||||
@@ -216,6 +220,7 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q12140": CardType.science_thing, # medication
|
||||
"Q11276": CardType.science_thing, # globular cluster
|
||||
"Q83373": CardType.science_thing, # quasar
|
||||
"Q177719": CardType.science_thing, # medical diagnosis
|
||||
"Q898273": CardType.science_thing, # protein domain
|
||||
"Q134808": CardType.science_thing, # vaccine
|
||||
"Q168845": CardType.science_thing, # star cluster
|
||||
@@ -224,7 +229,8 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
||||
"Q1840368": CardType.science_thing, # cloud type
|
||||
"Q2154519": CardType.science_thing, # astrophysical x-ray source
|
||||
"Q17444909": CardType.science_thing, # astronomical object type
|
||||
"Q12089225": CardType.science_thing, # Mineral species
|
||||
"Q12089225": CardType.science_thing, # mineral species
|
||||
"Q55640599": CardType.science_thing, # group of chemical entities
|
||||
"Q113145171": CardType.science_thing, # type of chemical entity
|
||||
|
||||
"Q1420": CardType.vehicle, # car
|
||||
@@ -519,7 +525,7 @@ async def _get_card_async(client: httpx.AsyncClient, page_title: str|None = None
|
||||
text=text,
|
||||
attack=attack,
|
||||
defense=defense,
|
||||
cost=min(12,max(1,int(((attack**2+defense**2)**0.18)/1.5)))
|
||||
cost=min(11,max(1,int(((attack**2+defense**2)**0.18)/1.5)))
|
||||
)
|
||||
|
||||
async def _get_cards_async(size: int) -> list[Card]:
|
||||
@@ -542,7 +548,7 @@ def generate_card(title: str) -> Card|None:
|
||||
|
||||
# Cards helper function
|
||||
def compute_deck_type(cards: list) -> str | None:
|
||||
if len(cards) < 20:
|
||||
if len(cards) == 0:
|
||||
return None
|
||||
avg_atk = sum(c.attack for c in cards) / len(cards)
|
||||
avg_def = sum(c.defense for c in cards) / len(cards)
|
||||
|
||||
Reference in New Issue
Block a user