Creating Hearthstone decks by using Genetic Algorithms

I’m glad you’re here, friend! There’s a chill outside, so pull up a chair by the hearth of our inn and prepare to learn how the Ancient Gods use the power of the secret and ancient branch of the Evolution to generate Hearthstone decks by means of the magic and mistery!!


Several months ago, my colleague Alberto Tonda and I were discussing about our latest adventures playing the Digital Collectible Card Game Hearthstone, when one of us said “Uhm, Genetic Algorithms usually work well with combinatorial problems, and solutions are usually a vector of elements. Elements such as cards. Such as cards of Hearthstone, the game we are playing right now while we are talking. Are you thinking what I’m thinking?”

Five minutes later we found an open-source Hearthstone simulator and started to think how to address the possibility of automatically evolve decks of Hearthstone.

The idea is quite simple: Hearthstone is played using a deck of 30 cards (from a pool of thousands available), so it is easy to model the candidate solution. With the simulator, we can perform several matches using different enemy decks, and obtain the number of victories. Therefore, we have a number that can be used to model the performance (fitness) of the deck.

Soooo, it’s easy to see one and one makes two, two and one makes three, and it was destiny, that we created a genetic algorithm that generates deck for Hearthstone for free.

Our preliminary results where discussed here, but we wanted to continue testing our method, so we tested using all available classes of the game, with the help of JJ, Giovanny and Antonio. All the best human-made decks were outperformed by our approach! And not only that, we applied a new operator called Smart Mutation that it is based in what we do when we test new decks in Hearthstone: we remove a card, and place another instead, but with +/-1 mana crystals, and not one completely random from the pool. The results were even better. Neat!

Maybe you prefer to read the abstract, that it is written in a more formal way than this post. You know, using the language of the science.

Collectible card games have been among the most popular and profitable products of the entertainment industry since the early days of Magic: The Gathering in the nineties. Digital versions have also appeared, with HearthStone: Heroes of WarCraft being one of the most popular. In Hearthstone, every player can play as a hero, from a set of nine, and build his/her deck before the game from a big pool of available cards, including both neutral and hero-specific cards.
This kind of games offers several challenges for researchers in artificial intelligence since they involve hidden information, unpredictable behaviour, and a large and rugged search space. Besides, an important part of player engagement in such games is a periodical input of new cards in the system, which mainly opens the door to new strategies for the players. Playtesting is the method used to check the new card sets for possible design flaws, and it is usually performed manually or via exhaustive search; in the case of Hearthstone, such test plays must take into account the chosen hero, with its specific kind of cards.
In this paper, we present a novel idea to improve and accelerate the playtesting process, systematically exploring the space of possible decks using an Evolutionary Algorithm (EA). This EA creates HearthStone decks which are then played by an AI versus established human-designed decks. Since the space of possible combinations that are play-tested is huge, search through the space of possible decks has been shortened via a new heuristic mutation operator, which is based on the behaviour of human players modifying their decks.
Results show the viability of our method for exploring the space of possible decks and automating the play-testing phase of game design. The resulting decks, that have been examined for balancedness by an expert player, outperform human-made ones when played by the AI; the introduction of the new heuristic operator helps to improve the obtained solutions, and basing the study on the whole set of heroes shows its validity through the whole range of decks.

You can download the complete paper from the Knowledge-based Systems Journal

See you in future adventures!!!


Early prediction of the outcome of Starcraft Games

As a result of Antonio Álvarez Caballero master’s thesis, we’ll be presenting tomorrow at the IJCCI 2017 conference a poster on the early prediction of Starcraft games.
The basic idea behind this line of research is to try and find a model of the game so that we can do fast fitness evaluation of strategies without playing the whole game, which can take up to 60 minutes. That way, we can optimize those strategies in an evolutionary algorithm and find the best ones.
In our usual open science style, paper and data are available in a repository.
Our conclusions say that we might be able to pull that off, using k-nearest neighbor algorithm. But we might have to investigate a bit further if we really want to find a model that gives us some insight about what makes a strategy a winner.


Dark clouds allow early prediction of heavy rain in Funchal, near where IJCCI is taking place

Our TORCS driving controller presented at EvoGAMES 2017

Last week, @jjmerelo presented at EvoGAMES 2017 (inside Evo* 2017) our work titled “Driving in TORCS using modular fuzzy controllers”.

This paper presents a novel car racing controller for TORCS (The Open Racing Car Simulator), which is based in the combination of two fuzzy subcontrollers, one for setting the speed, and one to control the steer angle. The obtained results are quite promissing, as the controller is quite competitive even against very tough TORCS teams.

The abstract of the paper is:

When driving a car it is essential to take into account all possible factors; even more so when, like in the TORCS simulated race game, the objective is not only to avoid collisions, but also to win the race within a limited budget. In this paper, we present the design of an autonomous driver for racing car in a simulated race. Unlike previous controllers, that only used fuzzy logic approaches for either acceleration or steering, the proposed driver uses simultaneously two fuzzy controllers for steering and computing the target speed of the car at every moment of the race. They use the track border sensors as inputs and besides, for enhanced safety, it has also taken into account the relative position of the other competitors. The proposed fuzzy driver is evaluated in practise and timed races giving good results across a wide variety of racing tracks, mainly those that have many turning points.

There was an interactive presentation at the conference, together with a poster:

The paper is available online from:

Enjoy (and cite) it! :D


Master of Evolution! Using Genetic Algorithms to generate decks for the game HearthStone

This September we attended to the IEEE CIG 2017 Conference in Santorini, Greece, to present the paper “Evolutionary Deckbuilding in HearthStone”. This paper was written in collaboration with our colleagues Alberto Tonda and Giovanni Squillero.

The story of this paper started a (not so) long time ago while me and Alberto were discussing about how awesome HearthStone is. Suddenly, we thought about how easy it would be to create the constraints for the uGP framework, and that there were some open source simulators of the game. In a while, we already had the constraints, the simulator adapted to accept individuals from uGP, and some experiments running.

And we finished the paper after, of course.

You can download the paper draft from here (the electronic original version is not available yet).

And here is the presentation:

The abstract:

—One of the most notable features of collectible card games is deckbuilding, that is, defining a personalized deck before the real game. Deckbuilding is a challenge that involves a big and rugged search space, with different and unpredictable behaviour
after simple card changes and even hidden information. In this paper, we explore the possibility of automated deckbuilding: a genetic algorithm is applied to the task, with the evaluation delegated to a game simulator that tests every potential deck against a varied and representative range of human-made decks.
In these preliminary experiments, the approach has proven able to create quite effective decks, a promising result that proves that, even in this challenging environment, evolutionary algorithms can find good solutions.

[Paper] My life as a sim: evolving unique and engaging life stories using virtual worlds

Our latest publication My life as a sim: evolving unique and engaging life stories using virtual worlds, using our framework MADE (created by @rubenhek), has been published in the ALIFE 2014 conference. The abstract:

Stories are not only painfully weaved by crafty writers in the solitude of their studios; they also have to be produced massively for non-player characters in the video game industry or tailored to particular tastes in personalized stories. However, the creation of fictional stories is a very complex task that usually implies a creative process where the author has to combine characters, conflicts and backstories to create an engaging narrative. This work describes a general methodology to generate cohesive and coherent backstories where desired archetypes (universally accepted literary symbols) can emerge in complex stochastic systems. This methodology supports the modeling and parametrization of the agents, the environment where they will live and the desired literary setting. The use of a Genetic Algorithm (GA) is proposed to establish the parameter configuration that will lead to backstories that best fit the setting. Information extracted from a simulation can then be used to create the literary work. To demonstrate the adequacy of the methodology, we perform an implementation using a specific multi-agent system and evaluate the results, testing with three different literary settings.

Check out the presentation by @jjmerelo at You can download the proceedings of the conference (CC license), or download the paper draft.

More information is available on the project page.

EVOGames CFP 11/Nov


EVOGames es una sesión dedicada a la investigación dentro del campo de los videojuegos, que se incluye dentro del congreso EVO* 2014, que se celebrará en Granada del 23 al 25 de Abril del próximo año.

El Call for Papers ha sido retrasado hasta el 11 de Noviembre, fecha definitiva para el envío de artículos.


EVOGames is a Special Session devoted to research works in videgames scope. It is included inside EVO* 2014, to be held in Granada (Spain) next month of April.

The CFP has been delayed to the 11th of November.

Is entropy good for solving the game of MasterMind?

Well, it does. In another paper published in the Evostar conference, we compare several methods for measuring how good a combination is when compared to the others that could possibly be the solution; so far we had mostly used most parts (counting the number of non-zero partitions), but, in this paper, that compares our previous Evo method with another created by the coauthors, Maestro-Montojo and Salcedo-Sanz, we find that Entropy, at least for these sizes, is the way to go. Here’s the poster

You can access the paper Comparing Evolutionary Algorithms to Solve the Game of MasterMind, by Javier Maestro-Montojo, Juan Julián Merelo and Sancho Salcedo-Sanz (first and last authors from the University of Alcalá de Henares) online or request a copy from the authors.