hearthbreaker icon indicating copy to clipboard operation
hearthbreaker copied to clipboard

Tried to put back a card that hadn't been used yet

Open Ragowit opened this issue 9 years ago • 7 comments

Sorry, I messed up and forgot the decks.

Traceback (most recent call last):
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 583, in UCTPlayGame
    m = UCT(rootstate = state, seconds = 12000, verbose = False)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 553, in UCT
    state.DoMove(random.choice(state.GetMoves()))
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 177, in DoMove
    self.game.current_player.minions[move[3]].attack()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 943, in attack
    super().attack()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 455, in attack
    self.player.game.check_delayed()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\engine.py", line 91, in check_delayed
    minion.activate_delayed()
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 526, in activate_delayed
    self.trigger(delayed['event'], *delayed['args'])
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 130, in trigger
    handler[0](*args)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\game_objects.py", line 967, in delayed_death
    rattle.do(self)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\tags\base.py", line 566, in do
    super().do(target)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\tags\base.py", line 539, in do
    action.act(owner, t, other)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\tags\action.py", line 330, in act
    target.deck.put_back(self.card.get_card(target, target, actor))
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\engine.py", line 565, in put_back
    raise GameException("Tried to put back a card that hadn't been used yet")
hearthbreaker.game_objects.GameException: Tried to put back a card that hadn't been used yet

Ragowit avatar Apr 17 '15 22:04 Ragowit

Will try reproduce, with deck information.

Ragowit avatar Apr 17 '15 22:04 Ragowit

Looks like Malorne was the root of the problem, but I don't know why. Maybe he came out of a sneeds/webspinner/unstable portal.

danielyule avatar Apr 17 '15 23:04 danielyule

Now, I think the problem is that when Malorne comes out of an unstable portal or whichever, his card isn't set as "drawn." So then when he's added back into the deck, it has a problem. It's easy to fix if this is the problem, but I can't think of how to test this to verify the situation, since it requires getting the right card out of random chance.

danielyule avatar Apr 19 '15 18:04 danielyule

Maybe an ugly solution, but can we create a testcard of Unstable Portal which can only get Malorne? Would that work?

Ragowit avatar Apr 20 '15 21:04 Ragowit

Or create a test and then iterate through random seed until we find one that summons Malorne, and then scratch the iteration and use the seed number?

for i in range(10000):
    random.seed(i)
    game = ... test case

Once found:

random.seed(268)
game = ... test case

Ragowit avatar Apr 21 '15 10:04 Ragowit

So, I followed your suggestion about a Malorne specific Unstable Portal, and it passed just fine. Then I thought it might be mindgames, but that one works fine as well. Basically, I can't seem to find a way to cause this error.

danielyule avatar Apr 21 '15 13:04 danielyule

Maybe put this one on hold until I get the error again with deck information.

Ragowit avatar Apr 21 '15 13:04 Ragowit