Skip to content

Ragowit/HearthSim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#HearthSim

HearthSim is a generic Hearthstone game simulator and AI, designed to run large numbers of simulated AI vs AI games in order to test and understand the values of various game mechanics and cards.

The code has two main components: the game mechanics and the AI.

##Game Mechanics

The game mechanics include the implementation of individual cards as well as the turn based draw card, use card, and attack mechanisms.

The state of the game is represented in with the BoardState class. The BoardState is the combined states of: hero state, friendly minions, enemy hero state, enemy minions, the cards in the hero's hand, and how many cards have been drawn from the deck. All actions in the game are represented as changes to the given BoardState.

Each card and minion is modeled as a derivative of the Card class. The job of each card is to manipulate the BoardState upon its use, either from the hero's hand or from the board as a minion.

Finally, there is the BoardStateFactory class, whose job is to recursively generate all possible BoardStates resulting from taking all possibles actions from a single starting BoardState.

##AI Model

Detailed AI model descrition can be found here.

The essence of the AI model is the score function, which is a function of BoardState. For each BoardState generated by the BoardStateFactory, the AI determines the score and picks the chain of BoardStates resulting in the highest score as its play. The difference in AI really just comes down to the difference in the scoring function it uses.

##Running Simulations

There is an example simulation setup in the example directory. Once you have the project compiled (assuming you named the resulting .jar file hearthsim.jar), you can run it like this:

java -jar hearthsim.jar masterParams.hsparam

or whatever is the actual path to the simulation parameter file.

##Some Results

You can find some simulation results HearthSim board or on my blog.

##Contributing

To contribute, follow the usual procedure: fork, make changes, and submit a pull request.

For discussions, questions, or comments, join the dev board here.

About

Generic Hearthstone game simulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.9%
  • Python 0.1%