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

How to simulate the game board state, and run for analyze #169

Open
chucklu opened this issue Jul 23, 2019 · 4 comments
Open

How to simulate the game board state, and run for analyze #169

chucklu opened this issue Jul 23, 2019 · 4 comments

Comments

@chucklu
Copy link
Contributor

chucklu commented Jul 23, 2019

Currently, I want to simulate this game in 5th turn.
https://hsreplay.net/replay/EPYWPdrBBaELpVVq3aiBEc#turn=5b

After check the sample code in SabberStone\core-extensions\SabberStoneCoreConsole\src\Program.cs
My problem is:
1.How can I set the cards in hand for each player
2.How can I set the minions already on board for each player
3.How can I start the analyze when I finish the above two steps
I have checked the start game method, it contains the following code

// first turn
			Turn = 1;

Actually I want to simulate the 5th turn when I have only one mana left.
I can summon a totem first, then play the sea giant. Instead of playing the sea giant directly.
image

I want to check if SabberStone intelligent enough to give the correct move for the above game state.
This is one turn analyze, actually I only want to set the minions for each player and the mana left for me and the cards on my hand. Maybe the hero skill should be calculated.

@chucklu
Copy link
Contributor Author

chucklu commented Jul 23, 2019

I have written a sample code https://github.com/ChuckForkHearthBuddy/SabberStone/blob/chuck-master/SabberStoneCoreTest/src/ChuckTest.cs

You can get the game record from https://hsreplay.net/api/v1/games/EPYWPdrBBaELpVVq3aiBEc/
And from the replay_xml property of the json response, you can get the battle detail of this game.
It seems the hsreplay used the replay_xml to re-play the game online.

@darkfriend77
Copy link
Contributor

darkfriend77 commented Jul 23, 2019

There are 2 possibilities to achieve the same setup as your reference game. One is replaying the refrerence game and correcting random events, the other one is just recreating the game state, which can be a little bit tricky.

  1. Just set the decks in the order they are drawn and set shuffle to false. So they will have the same cards in hand on turn 5, if there are some random draws just exchange the random drawn card with the one that was pulled in you're reference game.

  1. Same just recreate the same moves from your reference game, random board minions just replace by the one from your reference game. Random Events like damage have to be adjusted as well including all the sub events.

  2. Don't know what intelligence you are referencing to as of my knowledge there is only a super simple one turn test AI implememented.

https://github.com/HearthSim/SabberStone/tree/master/core-extensions/SabberStoneCoreAi

But you could just feed the previously created game to that simpulator.

@chucklu
Copy link
Contributor Author

chucklu commented Jul 23, 2019

One turn test AI, it's enough.
Did it support to give best move according a given game board state?

@chucklu
Copy link
Contributor Author

chucklu commented Aug 12, 2019

@darkfriend77 Here is an example about how to simulate the current board state.
https://github.com/sliverfishes/silverfish/blob/master/README.md
Maybe you can get some idea from this case:

#######################################################################
start calculations, current time: 00:00:00:0000 V116.27 control 5000 face 15 twoturnsim 1000 ntss 6 16 160 playaround 50 80 ets 16 ets2 160 ents 16 secret
#######################################################################
mana 3/10
emana 10
own secretsCount: 0
enemy secretsCount: 0 ;
player:
1 2 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
ownhero:
priest 27 30 0 False False 4 True 0 False 0 0
weapon: 0 0 unknown
ability: True CS1h_001 3
osecrets:
enemyhero:
warrior 15 30 35 False False 36
weapon: 0 0 unknown
ability: True AT_132_WARRIOR 0
fatigue: 9 0 7 0
OwnMinions:
twilightguardian AT_017 zp:1 e:212 A:4 H:10 mH:10 rdy:False natt:0 ex ptt spllpwr(1)
EnemyMinions:
boombot GVG_110t zp:1 e:184 A:1 H:1 mH:1 rdy:True natt:0 ex
Own Handcards:
pos 1 arcaneintellect 3 entity 9 CS2_023 0 0
Enemy cards: 4
ownDiedMinions:
enemyDiedMinions:
og: 169,2;1152,1;248,2;246,2;251,1;557,2;1150,2;209,2;430,2;642,1;372,1;1010,2;371,1;701,2;
eg: 995,1;708,1;429,2;740,2;495,1;514,1;648,2;333,1;241,2;516,2;1218,1;188,2;749,2;

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

No branches or pull requests

2 participants