title: How should I design a good evaluation function for Connect 4?
body: <p>I've a java implementation of "Connect 4" game (<strong>with a variable number of columns and rows</strong>) .</p>
  
  <p>This implementation use (according to the choice of the user) Mini-max algorithm of Mini-max with Alpha-beta pruning with a maximum depth of searching of <strong>maxDepth</strong></p>
  
  <p>My problem now is the design of a <strong>good evaluation function for the state of the board</strong> (this is the value returned at maxDepth).</p>
  
  <p>The value is between <strong>-100 (worst choise,it corresponds to a losing situation)</strong> and <strong>100 (best choise,it corresponds to a winning situation)</strong> where <strong>0</strong> is supposed to be <strong>"draw" situation</strong>.</p>
  
  <p>Actually I've implemented two functions (I report pseudo-code because the code is very long)</p>
  
  <p>1) </p>
  
  <ul>
  <li>no win / no lose</li>
  </ul>
  
  <p>--> if table is full ==> draw (0)</p>
  
  <p>--> if table isn't full ==> unsure situation (50)</p>
  
  <ul>
  <li>win</li>
  </ul>
  
  <p>--> if my win: 100</p>
  
  <p>--> if win of opponent: -100</p>
  
  <p>2) </p>
  
  <pre><code>Of me:
  - InARow[0] = maximum number of pieces in a HORIZONTAL in a row
  - InARow[1] = maximum number of pieces in a VERTICAL in a row
  - InARow[2] = maximum number of pieces in a DIAGONAL (ascending) in a row
  - InARow[3] = maximum number of pieces in a DIAGONAL (descending) in a row
  Of the opponent
  - InARow2[0] = maximum number of pieces in a HORIZONTAL in a row
  - InARow2[1] = maximum number of pieces in a VERTICAL in a row
  - InARow2[2] = maximum number of pieces in a DIAGONAL (ascending) in a row
  - InARow2[3] = maximum number of pieces in a DIAGONAL (descending) in a row
  
  value = (100* (InARow[0] + InARow[1] + InARow[2] + InARow[3]) )/16 - (100* (InARow2[0] + InARow2[1] + InARow2[2] + InARow2[3]) )/16  
  </code></pre>
  
  <p>I need to design a <strong>third (and if possible better)</strong> function. Any suggestion?</p>
  
  <p>Thank you in advance.</p>