danielyule / hearthbreaker

A Hearthstone: Heroes of WarCraft Simulator for the purposes of Machine Learning and Data Mining
MIT License
505 stars 122 forks source link

Secret reveal not in list #61

Closed Ragowit closed 9 years ago

Ragowit commented 9 years ago

My MCTS AI fork continues to find errors, here's the latest one between a mage and a paladin. I don't know the specific decks they were using (I randomize the decks). I need to find a way to print out the card for better error logs, or save a replay if it crash.

Traceback (most recent call last):
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 415, in <module>
    UCTPlayGame()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 402, in UCTPlayGame
    m = UCT(rootstate = state, seconds = 320, verbose = False)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 377, in UCT
    state.DoMove(random.choice(state.GetMoves()))
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 122, in DoMove
    self.game.current_player.minions[move[3]].attack()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1170, in attack
    super().attack()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 387, in attack
    self.player.game.check_delayed()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1851, in check_delayed
    minion.activate_delayed()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 440, in activate_delayed
    self.trigger(delayed['event'], *delayed['args'])
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 174, in trigger
    handler.function(*args)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1197, in delayed_death
    self.player.trigger("minion_died", self, by)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 174, in trigger
    handler.function(*args)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\spells\paladin.py", line 269, in _reveal
    super().reveal()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1008, in reveal
    self.player.secrets.remove(self)
ValueError: list.remove(x): x not in list
Ragowit commented 9 years ago

Since it seems to be on the "minion_died" event, and a paladin spell, so do I assume it's either the secret Avenge or Redemption.

Ragowit commented 9 years ago

I should not look at code so early in the morning. It clearly says line 269 in spells\paladin.py, that's Redemption.

danielyule commented 9 years ago

The good news is that while I was investigating this, I uncovered an unrelated bug in Noble Sacrifice. The bad news is, I cannot replicate this problem. I don't think replay logging is necessary (although you certainly could add that fairly easily), but knowing what the deck was would help. I'll keep thinking about it.

Ragowit commented 9 years ago

I'll make sure to have deck information for future issues.

Ragowit commented 9 years ago

Got a new error with this, but this time so is the secret Ice Block. And I have the decks.

Deck 1: Bloodfen Raptor, Hellfire, Sacrificial Pact, Soulfire, Corruption, Hellfire, Sacrificial Pact, Imp Master, Gurubashi Berserker, Dalaran Mage, Tinkmaster Overspark, Oasis Snapjaw, Ironforge Rifleman, Nightblade, Wailing Soul, Nightblade, Stranglethorn Tiger, Amani Berserker, Gnomish Inventor, Silverback Patriarch, Grimscale Oracle, Ironfur Grizzly, Archmage, Ironfur Grizzly, Goldshire Footman, War Golem, Lord of the Arena, Mad Bomber, Zombie Chow, Murloc Raider

Deck 2: Molten Giant, Reckless Rocketeer, Feugen, Shade of Naxxramas, Gurubashi Berserker, Gruul, Murloc Raider, Arcane Intellect, Lorewalker Cho, Bloodsail Raider, Alexstrasza, Southsea Deckhand, Darkscale Healer, Dread Corsair, Bloodsail Corsair, Ysera, Arcane Golem, Wailing Soul, Malygos, Frost Elemental, Crazed Alchemist, Ice Block, Ironforge Rifleman, Arcane Nullifier X-21, Dire Wolf Alpha, Mirror Image, War Golem, Leeroy Jenkins, Molten Giant, Mountain Giant

Traceback (most recent call last):
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 139, in DoMove
    self.game.play_card(self.game.current_player.hand[move[3]])
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 2005, in play_card
    card.use(self.current_player, self)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\spells\warlock.py", line 39, in use
    minion.damage(player.effective_spell_damage(3), self)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1570, in damage
    super().damage(new_amount, attacker)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 475, in damage
    self.player.trigger("character_damaged", self, attacker, amount)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 179, in trigger
    handler.function(*args)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\spells\mage.py", line 219, in _reveal
    super().reveal()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 1007, in reveal
    self.player.secrets.remove(self)
ValueError: list.remove(x): x not in list
danielyule commented 9 years ago

OK, I can replicate this one now. I still don't know why, but I am working on it. Secrets appear to be behaving oddly....

danielyule commented 9 years ago

Lorewalker Cho was the culprit. When he was passing cards back and forth, he wasn't passing a copy, he was passing the actual card. Thus, when the secret was removed from one side, it wasn't removed from the other, but its reference to its owning player was wrong, which caused the error. However, while working on this, I encountered another hang from RandomAgent, so now I'm fixing that as well.

danielyule commented 9 years ago

Turns out Ice Block's immunity was never going away. If only....