title: How to simulate battle between two players?
body: <p>I've got two players and I want to simulate a game between them. Both have some attributes (power, intelligence...) and different actions. The outcome of some action is based on attribute values and some luck factor.</p>
  
  <p>Algorithm:</p>
  
  <ul>
  <li>Construct a game tree of all possible moves for both players
  <ul>
  <li>game tree would probably have limited depth</li>
  <li>Every level would belong to different player</li>
  </ul></li>
  <li>Use some heuristics at leaf nodes to find out probability of wining for player who has to make a move</li>
  <li>propagate probabilities up (like minimax algorithm does)</li>
  <li>choose a move with highest probability</li>
  <li>continue at the beginning of this algorithm</li>
  </ul>
  
  <p>So, basically this is minimax algorithm. I've got few question though:</p>
  
  <ol>
  <li>How to take luck factor in account?</li>
  <li>When I make one move, do I have to run whole algorithm again? (building the tree with +1 depth and new root node, calculate new probabilities...)</li>
  <li>Any other idea for simulating a battle?</li>
  </ol>
  
  <p>Thanks.</p>