GAIGResearch / TabletopGames

MIT License
80 stars 68 forks source link

Exceptions in Terraforming Mars and Catan #288

Open ManuelEberhardinger opened 2 months ago

ManuelEberhardinger commented 2 months ago

Hey all,

I played around with a few games that interested me, for maybe doing some research on explainability.

I wanted to collect some game traces for Terraforming Mars, but couldn't get a full game rollout because an exception was always thrown after a while.

For example in Terraforming Mars with OSLA (first exception) and MCTS (second exception):

Exception in thread "Thread-0" java.lang.AssertionError: Card cannot be played Play card id 760
    at games.terraformingmars.actions.TMAction.execute(TMAction.java:144)
    at games.terraformingmars.actions.PayForAction._afterAction(PayForAction.java:136)
    at core.StandardForwardModelWithTurnOrder._next(StandardForwardModelWithTurnOrder.java:32)
    at core.AbstractForwardModel.next(AbstractForwardModel.java:155)
    at players.simple.OSLAPlayer._getAction(OSLAPlayer.java:50)
    at core.AbstractPlayer.getAction(AbstractPlayer.java:70)
    at core.Game.oneAction(Game.java:577)
    at core.Game.run(Game.java:475)
    at gui.Frontend.lambda$new$11(Frontend.java:326)
    at java.base/java.lang.Thread.run(Thread.java:1570)

Exception in thread "Thread-1" java.lang.AssertionError: No actions available in rollout! Last action: Discard card id 1752
    at players.mcts.SingleTreeNode.rollout(SingleTreeNode.java:898)
    at players.mcts.SingleTreeNode.oneSearchIteration(SingleTreeNode.java:384)
    at players.mcts.SingleTreeNode.mctsSearch(SingleTreeNode.java:339)
    at players.mcts.MCTSPlayer._getAction(MCTSPlayer.java:258)
    at core.AbstractPlayer.getAction(AbstractPlayer.java:70)
    at core.Game.oneAction(Game.java:577)
    at core.Game.run(Game.java:475)
    at gui.Frontend.lambda$new$11(Frontend.java:326)
    at java.base/java.lang.Thread.run(Thread.java:1570)

Exception in thread "Thread-2" java.lang.AssertionError: Card cannot be played Add 1 Science on card
    at games.terraformingmars.actions.TMAction.execute(TMAction.java:144)
    at core.StandardForwardModelWithTurnOrder._next(StandardForwardModelWithTurnOrder.java:21)
    at core.AbstractForwardModel.next(AbstractForwardModel.java:155)
    at players.mcts.SingleTreeNode.advanceState(SingleTreeNode.java:556)
    at players.mcts.SingleTreeNode.rollout(SingleTreeNode.java:903)
    at players.mcts.SingleTreeNode.oneSearchIteration(SingleTreeNode.java:384)
    at players.mcts.SingleTreeNode.mctsSearch(SingleTreeNode.java:339)
    at players.mcts.MCTSPlayer._getAction(MCTSPlayer.java:258)
    at core.AbstractPlayer.getAction(AbstractPlayer.java:70)
    at core.Game.oneAction(Game.java:577)
    at core.Game.run(Game.java:475)
    at gui.Frontend.lambda$new$11(Frontend.java:326)
    at java.base/java.lang.Thread.run(Thread.java:1570)

And also sometimes in Catan, but the game keeps on playing so maybe it's nothing too important. Also in the second exception it said "Game over" after 7 victory points. I thought the normal game used 10 VP?

Actionp1 discards: [ORE, ORE, ORE, GRAIN]
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 4
    at games.catan.CatanParameters$ResourceAmount.translate(CatanParameters.java:111)
    at games.catan.gui.CatanGUI.resourcePrint(CatanGUI.java:421)
    at games.catan.gui.CatanGUI._update(CatanGUI.java:362)
    at gui.AbstractGUIManager.update(AbstractGUIManager.java:285)
    at gui.Frontend.updateGUI(Frontend.java:546)
    at gui.Frontend.lambda$new$10(Frontend.java:320)
    at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
    at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Game over: [LOSE_GAME, LOSE_GAME, WIN_GAME]
Exception in thread "Thread-4" java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 4
    at games.catan.CatanParameters$ResourceAmount.translate(CatanParameters.java:111)
    at games.catan.gui.CatanGUI.resourcePrint(CatanGUI.java:421)
    at games.catan.gui.CatanGUI._update(CatanGUI.java:362)
    at gui.AbstractGUIManager.update(AbstractGUIManager.java:285)
    at gui.Frontend.updateGUI(Frontend.java:546)
    at gui.Frontend.lambda$new$11(Frontend.java:330)
    at java.base/java.lang.Thread.run(Thread.java:1570)

Thanks! Manuel

hopshackle commented 2 months ago

Hi Manuel,

Thanks for playing!

I'll have a look at the Catan issues, as this is a game that should be pretty robust. Terraforming Mars is less used at the moment, and I'll need to wait for Raluca to get back from holiday to have a look in detail.

I suggest we continue this discussion on the detail on our Discord server at https://discord.gg/7trnjzGc

James

hopshackle commented 2 months ago

The Catan GUI issue is now fixed.

Looking at the errors from Terraforming Mars, this is the same issue as #232