get the result of the game in finalizeGame()?

89 views
Skip to first unread message

Jonas

unread,
Jun 4, 2018, 5:07:27 PM6/4/18
to The Hearthstone-AI Competition
Hello,

i have another Question.
Is there a posibility to get the result of the game (like Win/Loss/Draw) in the finalizeGame() function?
(or something like a final poGame-Entity)
I could really use it, but did not find a way...

Best regards
Jonas

hm.w...@gmail.com

unread,
Jun 8, 2018, 4:09:38 PM6/8/18
to The Hearthstone-AI Competition
Hey there,

do the following:

Go to POGameHandler.cs in AI=>SabberStoneCoreAi=>Src=>POGame=>POGameHandler.cs

At the end of the "public bool PlayGame(bool addToGameStats=true)" function at lines 95 & 96 it calls the FinalizeGames() of the two players.

Replace the two calls with           
player1.FinalizeGame(game.CurrentPlayer == game.Player1 ? game.CurrentPlayer.PlayState : game.CurrentOpponent.PlayState);
player2
.FinalizeGame(!(game.CurrentPlayer == game.Player1) ? game.CurrentPlayer.PlayState : game.CurrentOpponent.PlayState);

Now go to the AbstractAgent.cs and define this function:

public abstract void FinalizeGame(PlayState playState);
and define a using at the beginning of the file:
using SabberStoneCore.Enums;

Now browse to ALL the different agents and define the
public override void FinalizeGame(PlayState playState)
{
}
function and the using statement in these (as you did in the AbstractAgent).
You have to define it in all agents or else it will throw errors.


The playState contains the information you asked for.

Before submitting your agent make sure it is runnable on a "vanilla" version of SabberStone ie. remove the "override" in the FinalizeGame(PlayState playState)
so it will not try to override a nonexistent abstract function in AbstractAgent.cs and throw an error/exception.


Best regards
Hans-Martin

dockhorn....@gmail.com

unread,
Jun 10, 2018, 7:34:24 AM6/10/18
to the-hearthstone...@googlegroups.com
Thank Hans-Martin for proposing this fix.
I currently refrain from adding this to the main-framework.
It is the intended functionality, but adding this fix now might break already developed agents.
Furthermore, since the agent should not learn during our evaluation we would like to forward people to use your proposed approach ;)
Best regards,
Alex
Reply all
Reply to author
Forward
0 new messages