Monte Carlo AI GameImpl.playPriority Bug
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 940
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 160
Description
I'm running into issues running a game with 4 monte carlo bots.
`
INFO 2025-05-30 22:08:11,868 GAME started e6972116-84d1-4ce9-8dad-9dd40b84283a [Game] derDosch - Computer 4 - Computer 3 - Computer 5 - Computer 2 =>[CALL - 1] TableController.startGame
FATAL 2025-05-30 22:08:12,233 GameWorker system error [e6972116-84d1-4ce9-8dad-9dd40b84283a - Commander Free For All; T1; active: none; stack: 0]: java.lang.Error: Unresolved compilation problem:
The method and(Iterable>) in the type Predicates is not applicable for the arguments (List>)
=>[GAME e6972116-84d1-4ce9-8dad-9dd40b84283a] GameWorker.call
java.lang.Error: Unresolved compilation problem:
The method and(Iterable>) in the type Predicates is not applicable for the arguments (List>)
`
When I try to fix it like this, the Game starts but after short time it freezes.
My quick fix.
`
@Override
public boolean match(E e, Game game) {
if (checkObjectClass(e)) {
// return Predicates.and(predicates).apply(e, game);
return Predicates.and((Iterable>) predicates).apply(e, game);
}
return false;
}
`
Server Logs.
`
INFO 2025-05-30 22:37:44,014 GAME started 1d08d1f8-762f-4d95-9d08-b4dc5f539c78 [Game] derDosch - Computer 4 - Computer 3 - Computer 5 - Computer 2 =>[CALL - 1] TableController.startGame
FATAL 2025-05-30 22:37:45,575 Game error: 1d08d1f8-762f-4d95-9d08-b4dc5f539c78 - !!!SIMULATION, AI, NOT GAME THREAD!!! Commander Free For All; T1.UP; active: Computer 3; stack: 0 =>[AI-SIM-MCTS - 12] GameImpl.playPriority
java.lang.IllegalArgumentException: Wrong code usage: game related code must run in GAME thread, but it used in AI-SIM-MCTS - 12
at mage.util.ThreadUtils.ensureRunInGameThread(ThreadUtils.java:99)
at mage.game.GameImpl.checkConcede(GameImpl.java:872)
at mage.game.GameImpl.checkConcede(GameImpl.java:866)
at mage.game.GameImpl.checkStateAndTriggered(GameImpl.java:2296)
at mage.game.GameImpl.playPriority(GameImpl.java:1707)
at mage.game.turn.Step.priority(Step.java:73)
at mage.game.turn.Phase.resumeStep(Phase.java:232)
at mage.game.turn.Phase.resumePlay(Phase.java:142)
at mage.game.turn.Turn.resumePlay(Turn.java:177)
at mage.game.GameImpl.resume(GameImpl.java:1182)
at mage.player.ai.PriorityNextAction.performNextAction(PriorityNextAction.java:24)
at mage.player.ai.MCTSNode.expand(MCTSNode.java:129)
at mage.player.ai.MCTSExecutor.call(MCTSExecutor.java:45)
at mage.player.ai.MCTSExecutor.call(MCTSExecutor.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Throwable
... 18 more
...
FATAL 2025-05-30 22:30:20,836 Game end on critical error: mage.MageException: Too many errors, game will be end. Last error: java.lang.IllegalArgumentException: Wrong code usage: game related code must run in GAME thread, but it used in AI-SIM-MCTS - 3 =>[AI-SIM-MCTS - 3] GameImpl.playPriority
mage.MageException: Too many errors, game will be end. Last error: java.lang.IllegalArgumentException: Wrong code usage: game related code must run in GAME thread, but it used in AI-SIM-MCTS - 3
at mage.game.GameImpl.playPriority(GameImpl.java:1768)
at mage.game.turn.Step.priority(Step.java:73)
at mage.game.turn.Phase.resumeStep(Phase.java:232)
at mage.game.turn.Phase.resumePlay(Phase.java:142)
at mage.game.turn.Turn.resumePlay(Turn.java:177)
at mage.game.GameImpl.resume(GameImpl.java:1182)
at mage.player.ai.PriorityNextAction.performNextAction(PriorityNextAction.java:24)
at mage.player.ai.MCTSNode.expand(MCTSNode.java:129)
at mage.player.ai.MCTSExecutor.call(MCTSExecutor.java:45)
at mage.player.ai.MCTSExecutor.call(MCTSExecutor.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
WARN 2025-05-30 22:30:21,615 applyMCTS timeout =>[GAME cc9e2341-afd8-41a7-a38f-5cbef0885bbf] ComputerPlayerMCTS.applyMCTS
FATAL 2025-05-30 22:30:21,760 null ability =>[GAME cc9e2341-afd8-41a7-a38f-5cbef0885bbf] ComputerPlayerMCTS.priority
FATAL 2025-05-30 22:30:21,867 null ability =>[GAME cc9e2341-afd8-41a7-a38f-5cbef0885bbf] ComputerPlayerMCTS.priority
`
I hope this helps :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.