title: Genetic algorithm for a card game (Dominion)
body: <p>I have a working F# program that runs <a href="http://www.riograndegames.com/games.html?id=278" rel="nofollow">Dominion</a>, a card game. I would like to use a genetic algorithm to determine optimal strategies for playing. However, I don't know much about AI or genetic algorithms. Can you point me towards some good literature to get started?</p>
  
  <p>A strategy for playing consists of a reaction to a given hand. In each turn, a bot is dealt a hand of cards. It can choose to play action cards, or buy new cards, based on what it has been dealt. The goal is to end the game with as many victory point cards as possible.</p>
  
  <p>A hardcoded approach could look something like:</p>
  
  <pre><code>def play(hand, totalDeck):
      if hand contains Smithy then use Smithy
      if hand contains enough coins for Province then buy Province
      if more than 30% of the totalDeck is Smithy, then buy coins
  </code></pre>
  
  <p>I was thinking of describing a strategy in terms of a vector of target portions of the total deck for each card:</p>
  
  <pre><code>[Smithy, Province, Copper, ...]
  [.3, .2, .1, ...]
  </code></pre>
  
  <p>Then to mutate a bot, I could just change that vector around, and see if the mutated version does better. The fitness function would be the average score playing Dominion against a variety of other bots. (One bot's score is dependent on who it is playing against, but hopefully by playing many games against many bots this can even out.)</p>
  
  <p>Does this make sense? Am I headed down the right path?</p>