Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'game' #109

Open
Ragowit opened this issue Apr 15, 2015 · 13 comments
Open

'NoneType' object has no attribute 'game' #109

Ragowit opened this issue Apr 15, 2015 · 13 comments

Comments

@Ragowit
Copy link
Collaborator

Ragowit commented Apr 15, 2015

Deck 1: Tinkmaster Overspark, Duplicate, Dancing Swords, Darkscale Healer, Silverback Patriarch, Novice Engineer, Shattered Sun Cleric, Stonesplinter Trogg, Harvest Golem, Gelbin Mekkatorque, Dragonling Mechanic, Water Elemental, River Crocolisk, War Golem, Frostwolf Warlord, Azure Drake, Dancing Swords, Cult Master, Ship's Cannon, Frostwolf Warlord, Stormpike Commando, Silvermoon Guardian, Frostwolf Grunt, Flamecannon, Flamecannon, Wisp, Murloc Raider, Chillwind Yeti, Defender of Argus, Razorfen Hunter

Deck 2: Ogre Brute, Counterspell, Force-Tank MAX, Vaporize, Frost Elemental, Stalagg, Stampeding Kodo, Ethereal Arcanist, Bloodmage Thalnos, Lil' Exorcist, Wisp, Flesheating Ghoul, Coldlight Seer, Gnomish Experimenter, Gnomish Inventor, Jeeves, Silver Hand Knight, Illuminator, Piloted Shredder, Gnomish Inventor, War Golem, Force-Tank MAX, Mogu'shan Warden, Stranglethorn Tiger, Blood Knight, River Crocolisk, Tauren Warrior, Wee Spellstopper, Abomination, Chillwind Yeti

Traceback (most recent call last):
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\uct.py", line 429, in GetMoves
    if card.can_use(self.game.current_player, self.game) and isinstance(card, MinionCard):
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\base.py", line 491, in can_use
    return super().can_use(player, game) and self.name not in [secret.name for secret in player.secrets]
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\base.py", line 103, in can_use
    return player.mana >= self.mana_cost(player)
  File "C:\Users\Ragowit\Documents\GitHub\mcts\hearthbreaker\hearthbreaker\cards\base.py", line 121, in mana_cost
    for p in self.player.game.players
AttributeError: 'NoneType' object has no attribute 'game'
@danielyule
Copy link
Owner

I'm having trouble replicating this one. I've tried 40000 games with these decks, and no problem so far.

@danielyule
Copy link
Owner

100 000 games and no error. I think this one is going to be hard to track down.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 16, 2015

Hmm, I will be home from work in about an hour. Will see if I can help out and replicate it.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 19, 2015

Well I must admit that it's rare, but I got it again. These were the decks this time.

Deck 1: Chillwind Yeti, Defender of Argus, War Golem, Imp Master, Stranglethorn Tiger, Duplicate, Novice Engineer, Silverback Patriarch, Novice Engineer, Silverback Patriarch, Mechanical Yeti, Jungle Panther, Duplicate, Oasis Snapjaw, Water Elemental, Dalaran Mage, Mana Wyrm, Nightblade, Fen Creeper, Deathlord, Defender of Argus, Stonesplinter Trogg, Nightblade, Boulderfist Ogre, Fen Creeper, Frostwolf Grunt, Clockwork Gnome, Clockwork Gnome, Southsea Deckhand, Murloc Raider

Deck 2: Gazlowe, Stonetusk Boar, Hobgoblin, Boulderfist Ogre, Silvermoon Guardian, Loot Hoarder, Power Word: Shield, Jeeves, Sneed's Old Shredder, Mindgames, Abomination, Light of the Naaru, Captain Greenskin, Bloodmage Thalnos, Novice Engineer, Kel'Thuzad, Burly Rockjaw Trogg, Onyxia, Fel Reaver, Jungle Panther, War Golem, Thoughtsteal, Stampeding Kodo, Amani Berserker, Abusive Sergeant, Fen Creeper, Argent Commander, War Golem, Nat Pagle, Nozdormu

EDIT: The deck building AI had already chosen "Chillwind Yeti, Defender of Argus, War Golem, Imp Master, Stranglethorn Tiger", so it was probably doing a lot of iterations on Duplicate.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 19, 2015

And again. The deck building AI had already chosen "Imp Master", so it was probably doing a lot of iterations on Duplicate.

Deck 1: Imp Master, Duplicate, Murloc Raider, Gelbin Mekkatorque, Darkscale Healer, Silverback Patriarch, Novice Engineer, Shattered Sun Cleric, Stonesplinter Trogg, Harvest Golem, Frost Elemental, Dragonling Mechanic, Water Elemental, River Crocolisk, War Golem, Frostwolf Warlord, Silvermoon Guardian, Unstable Ghoul, Tinkmaster Overspark, Puddlestomper, Frostwolf Warlord, Stormpike Commando, Silvermoon Guardian, Frostwolf Grunt, Flamecannon, Flamecannon, Wisp, Murloc Raider, Dragonling Mechanic, Fen Creeper

Deck 2: Fen Creeper, Holy Light, Kel'Thuzad, Avenge, Voodoo Doctor, Booty Bay Bodyguard, Frostwolf Grunt, Gruul, Murloc Tidehunter, Novice Engineer, Nozdormu, Murloc Raider, Defender, Wailing Soul, Spectral Knight, Blessing of Might, Archmage, King Mukla, Loatheb, Kobold Geomancer, Razorfen Hunter, Stormwind Champion, Bloodmage Thalnos, Nerubian Egg, Blessed Champion, Bloodsail Corsair, Sunwalker, Emperor Thaurissan, Ogre Brute, Cairne Bloodhoof

@danielyule
Copy link
Owner

I found the cards in common between the two games and we have:

  • Bloodmage Thalnos
  • Frostwolf Grunt
  • Jeeves
  • Stonesplinter Trogg
  • Water Elemental
  • Murloc Raider
  • Abomination
  • Novice Engineer
  • Silverback Patriarch
  • Defender of Argus
  • Duplicate
  • Silvermoon Guardian
  • Chillwind Yeti
  • War Golem
  • Stampeding Kodo
  • Stranglethorn Tiger

The only card that it seems likely to have caused an issue is duplicate, but it's definitely setting the player. I'm still pretty baffled by this one.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 21, 2015

Again, more deck information. "Dancing Swords, Bloodsail Raider" had been selected by the AI, crashed when doing an iteration on Mad Scientist.

Deck 1: Dancing Swords, Bloodsail Raider, Mad Scientist, Duplicate, Gelbin Mekkatorque, Darkscale Healer, Silverback Patriarch, Novice Engineer, Shattered Sun Cleric, Stonesplinter Trogg, Harvest Golem, Frost Elemental, Dragonling Mechanic, Water Elemental, River Crocolisk, War Golem, Frostwolf Warlord, Silvermoon Guardian, Unstable Ghoul, Tinkmaster Overspark, Puddlestomper, Frostwolf Warlord, Stormpike Commando, Silvermoon Guardian, Frostwolf Grunt, Flamecannon, Flamecannon, Wisp, Murloc Raider, Chillwind Yeti

Deck 2: Puddlestomper, Spider Tank, Clockwork Gnome, Maexxna, Gazlowe, Youthful Brewmaster, Violet Teacher, Hogger, Redemption, Ysera, Sneed's Old Shredder, Pint-Sized Summoner, Jeeves, Piloted Shredder, Silverback Patriarch, Thrallmar Farseer, Gelbin Mekkatorque, Injured Blademaster, Blessing of Wisdom, Voodoo Doctor, Frostwolf Warlord, Sludge Belcher, Stalagg, Recombobulator, Deathwing, Cobalt Guardian, Bloodfen Raptor, Raid Leader, Priestess of Elune, Argent Squire

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 21, 2015

I encountered it again (deck information below), and I tried to reproduce it but got nothing with 276000 games and counting. This got me thinking, maybe it's the game.copy() event that is the problem? Does that one successfully copy all the secrets correctly?

Deck 1: Dragonling Mechanic, Duplicate, Nerub'ar Weblord, Darkscale Healer, Silverback Patriarch, Novice Engineer, Shattered Sun Cleric, Ship's Cannon, Harvest Golem, Frost Elemental, Dragonling Mechanic, Water Elemental, River Crocolisk, Ice Lance, Gurubashi Berserker, Azure Drake, Unstable Ghoul, Cult Master, Micro Machine, Gurubashi Berserker, Archmage, Silvermoon Guardian, Frostwolf Grunt, Maexxna, Kel'Thuzad, Argent Squire, Murloc Raider, Chillwind Yeti, Defender of Argus, Razorfen Hunter

Deck 2: Ragnaros the Firelord, Grimscale Oracle, Kobold Geomancer, Bloodsail Raider, Snowchugger, Tauren Warrior, Baron Rivendare, War Golem, Sunfury Protector, Argent Commander, Sunwalker, Gnomeregan Infantry, Sylvanas Windrunner, Harrison Jones, Onyxia, Kirin Tor Mage, Captain's Parrot, Dark Iron Dwarf, Southsea Deckhand, Murloc Tidehunter, Spider Tank, Acidic Swamp Ooze, Secretkeeper, Bomb Lobber, Dragon's Breath, Southsea Deckhand, Millhouse Manastorm, Dire Wolf Alpha, Kel'Thuzad, Doomsayer

@randomflyingtaco
Copy link
Collaborator

Does it have to do with duplicating noncollectable cards? The first game had Tinkmaster and Gelbin, second had Imp Master; third had Imp Master, Gelbin, and Tinkmaster; fourth had Gelbin, Tinkmaster Harvest Golem and Dragonling Mechanic; fifth had Dragonling, Harvest, and Razorfen.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 22, 2015

I added try-except into the mana_cost function that would print out the card if it got into the except part.

And it did indeed print out Duplicate.

I have not looked into the game.copy() idea I wrote about earlier.

Deck 1: Master Swordsmith, Duplicate, Nerub'ar Weblord, Darkscale Healer, Silverback Patriarch, Novice Engineer, Shattered Sun Cleric, Ship's Cannon, Harvest Golem, Frost Elemental, Dragonling Mechanic, Water Elemental, River Crocolisk, War Golem, Frostwolf Warlord, Silvermoon Guardian, Nerubian Egg, Tinkmaster Overspark, Micro Machine, Frostwolf Warlord, Stormpike Commando, Silvermoon Guardian, Frostwolf Grunt, Kel'Thuzad, Flamecannon, Wisp, Murloc Raider, Chillwind Yeti, Defender of Argus, Razorfen Hunter

Deck 2: Mana Wyrm, Murloc Tidecaller, Stormpike Commando, Sneed's Old Shredder, Gnomish Experimenter, Illuminator, Spellbreaker, Murloc Warleader, Worgen Infiltrator, Wee Spellstopper, Southsea Captain, Mirror Image, Twilight Drake, Raid Leader, Piloted Shredder, Murloc Tidecaller, Gurubashi Berserker, Hobgoblin, Lord of the Arena, Ironforge Rifleman, Harrison Jones, Stormpike Commando, Duplicate, Frostwolf Grunt, Sunwalker, Ravenholdt Assassin, Flesheating Ghoul, Piloted Sky Golem, Frost Elemental, Blizzard

@danielyule
Copy link
Owner

I figured it out. Some secrets are setting self.player to None when they are deactivated. What I don't understand is how a de-activated secret is making it back into a player's hand.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 24, 2015

I guess I could try and take a look into implementing the replay feature, saving it if I encounter a problem.

@Ragowit
Copy link
Collaborator Author

Ragowit commented Apr 25, 2015

If I did everything right with the replay thingie so is this the replay to get this error: https://gist.github.com/Ragowit/68bd9718e80dfc330ff5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants