title: Heuristic function for a board game AI
body: <p>I am trying to figure out a better heuristic function for a board game whose rules I will specify after the code. My evaluation function is this:</p>
  
  <pre><code>def evaluate(self, board):
          score = 0
          for i in range(board.LENGTH):
              for j in range(board.WIDTH):
                  if board.board[i][j].token == "G":
                      score += 100 * (i+1) + 50 * (j + 1)
                  if board.board[i][j].token == "R":
                      score -= 100 * (i+1) + 50 * (j + 1)
  return score
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tsv76.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tsv76.jpg" alt="Board"></a></p>
  
  <p>The initial board holds green and red tokens as shown. The AI moves first, playing the color opposite yours, attacking your tokens. On the black cells, a token can move either orthogonally (left, right, up, down) or diagonally. If it's on a white cell, you could move orthogonally only. </p>
  
  <p>When you move your token next to the opponent's token, you remove all the opponent's token in that direction.  E.g If i move the green token from C4 to C5, I will kill all R tokens on C-6 to C-9. This is called a forward attack. Similarly, if you have a token adjacent to an opponent's token you can move away from it, removing all the tokens in that line.</p>
  
  <p>Obviously, the tokens on the black cells have more possible moves.</p>
  
  <p>What would be a good heuristic function for the AI? What should I change in my current function?</p>