Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python 3 script for figuring out the best Ignite Mage deck
- # by Lt.Labcoat
- import random
- start_hand = []
- # unused card names:
- # biscuit-maker 2manadraw1 3manadraw2 heropower 3manaspellsearch arugal 2manaspellsearch
- # ice-search-2mana firesale sapience wonder-deck spicebaker
- # win at adjusted turn: 5.61
- deck_base_online = ["ice-search", "evoc",
- "tradeable", "tradeable",
- "sorc", "ele", "tradeable", "tradeable",
- "ice", "3manaspellsearch",
- ]*2
- deck_base_online += ["sorc-search", "firstflame", "firstflame"]
- deck_base_online += ["hotstreak", "sorc-search", "ele-search"]
- deck_base_online += ["ele-search", "ignite", "reflection", "hotstreak"]
- # win at adjusted turn: 5.356
- deck_base = ["ice-search", "evoc",
- "tradeable", "tradeable",
- "sorc", "ele", "tradeable", "tradeable",
- "ice", "tradeable",
- ]*2
- deck_base += ["varden", "firstflame", "firstflame"]
- deck_base += ["acolyte", "sorc-search", "ele-search"]
- deck_base += ["loatheb", "ignite", "reflection", "hotstreak"]
- #deck_base = deck_base_online
- if deck_base.count("tradeable") < 10:
- print(f'Tradeables: {deck_base.count("tradeable")}')
- spells = ["hotstreak", "evoc", "biscuit-maker", "firstflame", "ignite", "ice", "reflection", "heropower", "firesale", "springwater"]
- spells_chandler = ["hotstreak", "firstflame", "firstflame", "heropower"]
- spells_nonchandler = ["ice", "biscuit-maker", "firesale", "springwater"]
- spells_chandler_expensive = ["ignite", "reflection"]
- hand_skips = ["tradeable", "firesale", "3manadraw2", "firstflame", "hotstreak", "ele-search", "sorc-search", "ignite", "reflection", "2manadraw1"]
- print(f"Deck size: {len(deck_base)}")
- wonder_counter = 0
- turns_taken = []
- for i in range(0, 50000):
- deck = deck_base.copy()
- random.shuffle(deck)
- hand = list()
- enemy_is_spells = (i%100>=50)
- if start_hand:
- going_second = len(start_hand) % 4 == 0
- hand.extend(start_hand)
- else:
- going_second = (i%2==1)
- hand.append(deck.pop())
- hand.append(deck.pop())
- hand.append(deck.pop())
- if going_second:
- hand.append(deck.pop())
- # mulligan
- for c in range(0, len(hand)):
- hand_c = hand[c]
- if hand_c in hand_skips or (enemy_is_spells and hand_c == "varden") or (not enemy_is_spells and hand_c == "loatheb"):
- hand[c] = deck.pop(0)
- deck.append(hand_c)
- random.shuffle(deck)
- iced_turns = 0
- success = False
- sapience = False
- for turn in range(1, 20):
- if success:
- break
- mana = turn
- newcard = deck.pop()
- if sapience and (newcard in hand_skips or
- (newcard == "sorc" and "sorc" in hand) or (newcard == "ele" and "ele" in hand)):
- deck.append(newcard)
- newcard = deck.pop(0)
- random.shuffle(deck)
- hand.append(newcard)
- iced = False
- reloop = True
- arugal = False
- while reloop:
- #print(f"{turn} - {mana} -- {hand}")
- reloop = False
- # check for victory
- if "ele" in hand and "sorc" in hand:
- temp_mana = mana + hand.count("biscuit")*2 + hand.count("evoc")*2
- if going_second:
- temp_mana += 1
- if temp_mana >= 7:
- temp_mana += hand.count("biscuit-maker")*1
- if (temp_mana >= 9 and hand.count("sorc") == 2) or \
- (temp_mana >= 8 and "hotstreak" in hand and "reflection" in hand) or \
- (temp_mana >= 10 and "reflection" in hand):
- fire_in_hand_count = sum([hand.count(x) for x in spells_chandler])
- fire_in_hand_count += sum([hand.count(x) for x in spells_chandler_expensive])
- fire_in_hand_count -= sum([deck.count(x) for x in spells_nonchandler])
- if (temp_mana <= 9 and "hotstreak" not in hand) or (temp_mana <= 11):
- fire_in_hand_count -= 1 # reflection too expensive
- if fire_in_hand_count >= 1:
- turns_taken.append(turn - iced_turns)
- success = True
- break
- if temp_mana >= 8:
- # try with/find hotstreak
- fire_in_hand_count = sum([hand.count(x) for x in spells_chandler])
- fire_in_hand_count -= sum([deck.count(x) for x in spells_chandler_expensive])
- fire_in_hand_count -= sum([deck.count(x) for x in spells_nonchandler])
- fire_in_hand_count += hand.count("hotstreak") # yes this works
- if temp_mana >= 9: # ignite is playable
- fire_in_hand_count += 1
- if temp_mana >= 11: # ignite and reflection is playable too
- fire_in_hand_count += 1
- if fire_in_hand_count >= 1:
- turns_taken.append(turn - iced_turns)
- success = True
- break
- # auto-draw cards
- if "wonder-card" in hand:
- hand.remove("wonder-card")
- hand.append(deck.pop())
- wonder_counter += 1
- reloop = True
- # search cards
- if not iced and "ice-search" in hand and mana >= 3 and "ice" in deck:
- hand.remove("ice-search")
- deck.remove("ice")
- hand.append("ice")
- random.shuffle(deck)
- if not iced and "ice-search-2mana" in hand and mana >= 2 and "ice" in deck:
- hand.remove("ice-search-2mana")
- mana += 1
- deck.remove("ice")
- hand.append("ice")
- random.shuffle(deck)
- if not iced and "ice" in hand and mana >= 3:
- hand.remove("ice")
- mana -= 3
- iced = True
- iced_turns += 0.75
- if (not enemy_is_spells) and "varden" in hand and mana >= 4:
- hand.remove("varden")
- mana -= 4
- iced_turns += 1
- if (not enemy_is_spells) and "firesale" in hand and mana >= 4:
- hand.remove("firesale")
- mana -= 4
- turns_taken.append(turn - iced_turns)
- success = True
- break
- if enemy_is_spells and "loatheb" in hand and mana >= 5:
- hand.remove("loatheb")
- mana -= 5
- iced_turns += 1
- if "springwater" in hand and mana >= 5:
- hand.remove("springwater")
- mana -= 4
- newcard = deck.pop()
- hand.append(newcard)
- if newcard in spells:
- mana += 2
- newcard = deck.pop()
- hand.append(newcard)
- if newcard in spells:
- mana += 2
- random.shuffle(deck)
- reloop = True
- if "ele-search" in hand and mana >= 4 and "ele" not in hand:
- hand.remove("ele-search")
- mana -= 4
- deck.remove("ele")
- hand.append("ele")
- random.shuffle(deck)
- if "sorc-search" in hand and mana >= 4 and "sorc" in deck:
- hand.remove("sorc-search")
- mana -= 4
- deck.remove("sorc")
- hand.append("sorc")
- random.shuffle(deck)
- if "biscuit-maker" in hand and mana >= 2:
- hand.remove("biscuit-maker")
- mana -= 2
- hand.append("biscuit")
- if "2manadraw1" in hand and mana >= 2:
- hand.remove("2manadraw1")
- mana -= 2
- hand.append(deck.pop())
- random.shuffle(deck)
- reloop = True
- if "3manadraw2" in hand and mana >= 3:
- hand.remove("3manadraw2")
- mana -= 3
- hand.append(deck.pop())
- hand.append(deck.pop())
- random.shuffle(deck)
- iced_turns -= 0.25
- if "acolyte" in hand and mana >= 3:
- hand.remove("acolyte")
- mana -= 3
- hand.append(deck.pop())
- if random.random() > 0.8:
- hand.append(deck.pop())
- else:
- iced_turns += 0.125
- random.shuffle(deck)
- if "spicebaker" in hand and mana >= 4:
- hand.remove("spicebaker")
- mana -= 4
- iced_turns += 0.5
- random.shuffle(deck)
- if "6manadraw6" in hand and mana >= 6:
- hand.remove("6manadraw6")
- mana -= 6
- hand.append(deck.pop())
- hand.append(deck.pop())
- hand.append(deck.pop())
- hand.append(deck.pop())
- hand.append(deck.pop())
- hand.append(deck.pop())
- random.shuffle(deck)
- if "3manaspellsearch" in hand and mana >= 3:
- hand.remove("3manaspellsearch")
- mana -= 3
- newcard = deck.pop(0)
- tries = 0
- while newcard not in spells:
- tries += 1
- deck.append(newcard)
- if tries > 80:
- break
- newcard = deck.pop(0)
- hand.append(newcard)
- random.shuffle(deck)
- if newcard == "ice":
- iced_turns += 0.5
- reloop = True
- if "2manaspellsearch" in hand and mana >= 2:
- hand.remove("2manaspellsearch")
- mana -= 2
- newcard = deck.pop(0)
- tries = 0
- while newcard not in spells:
- tries += 1
- deck.append(newcard)
- if tries > 80:
- break
- newcard = deck.pop(0)
- if newcard in spells:
- hand.append(newcard)
- random.shuffle(deck)
- reloop = True
- if "4manaspellsearch" in hand and mana >= 4:
- hand.remove("4manaspellsearch")
- mana -= 4
- newcard = deck.pop(0)
- tries = 0
- while newcard not in spells:
- tries += 1
- deck.append(newcard)
- if tries > 50:
- break
- newcard = deck.pop(0)
- if newcard in spells:
- hand.append(newcard)
- random.shuffle(deck)
- if "3manadraw2" in hand and mana >= 3:
- hand.remove("3manadraw2")
- mana -= 3
- newcard = deck.pop(0)
- hand.append(newcard)
- random.shuffle(deck)
- reloop = True
- if "sapience" in hand and mana >= 1:
- hand.remove("sapience")
- mana -= 1
- sapience = True
- if "wonder-deck" in hand and mana >= 5:
- hand.remove("wonder-deck")
- mana -= 5
- deck.append("wonder-card")
- deck.append("wonder-card")
- deck.append("wonder-card")
- deck.append("wonder-card")
- deck.append("wonder-card")
- random.shuffle(deck)
- if "sorc-search" in hand and mana >= 4 and "sorc" not in deck:
- hand.remove("sorc-search")
- mana -= 4
- deck.remove("tradeable")
- hand.append("tradeable")
- random.shuffle(deck)
- if "ele-search" in hand and mana >= 4 and "ele" in deck:
- # second search
- hand.remove("ele-search")
- mana -= 4
- deck.remove("ele")
- hand.append("ele")
- random.shuffle(deck)
- if "arugal" in hand and mana >= 4:
- hand.remove("arugal")
- mana -= 2
- arugal = True
- if "tradeable" in hand and mana > 0:
- hand.remove("tradeable")
- mana -= 1
- newcard = deck.pop(0)
- if arugal:
- if newcard not in spells:
- hand.append(newcard)
- #while newcard == "tradeable":
- # deck.append("tradeable")
- # newcard = deck.pop(0)
- hand.append(newcard)
- deck.append("tradeable")
- random.shuffle(deck)
- reloop = True
- if "firesale" in hand and mana > 0:
- hand.remove("firesale")
- mana -= 1
- newcard = deck.pop(0)
- if arugal:
- if newcard not in spells:
- hand.append(newcard)
- #while newcard == "tradeable":
- # deck.append("tradeable")
- # newcard = deck.pop(0)
- hand.append(newcard)
- deck.append("firesale")
- random.shuffle(deck)
- reloop = True
- print(sum(turns_taken) / len(turns_taken))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement