forked from brownbat/autoEaseFactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deck_match.py
41 lines (36 loc) · 876 Bytes
/
deck_match.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def deck_match(deck_name, deck_list):
def parent_deck(dn):
if "::" not in dn:
return None
else:
return "::".join(dn.split("::")[:-1])
this_deck = deck_name
if this_deck is None:
return None
elif this_deck in deck_list:
return this_deck
else:
return deck_match(parent_deck(this_deck), deck_list)
def tests():
test_list = [
"Abacus",
"China::Second",
"China",
"China::First::Former"
]
test_decks = [
"Abacus",
"China::Second::Second",
"China",
"China::Third::Fourth",
"Second"
]
test_out = ""
for td in test_decks:
test_out += str(deck_match(td, test_list)) + ", "
# print(test_out)
if test_out == "Abacus, China::Second, China, China, None, ":
return True
else:
return False
# print(tests())