How to create an evaluation function for a TIC-TAC-TOE variant game

Viewed 10718

I'm actually working on a board game which is a variant of the TIC-TAC-TOE game. The specifics of the game are the followings :

1. The game is played on a nxn board, with n variable.

2. A player wins if he succeeds in placing k alignments the first, k is variable.

3. An alignment is constituted of l marks (X or O) in a horizontal, vertical or diagonal. l is fixed.

4. If the nxn grid is full (no player can add a mark either X or O) and no player succeeded in placing k alignments so the game is drawn.

I'm using an minmax with alpha-beta prunning algorithm. This is my first program with artificial intelligence and I don't know exactly how to create the evaluation function to be used by the algorithm. I saw some examples on the net which use a material weighting to evaluate a position but I can't apply that in my case. Actually, I'm using a radom evaluation function which returns a value between -100 and 100.

    float Conf_eval(Configuration c)
       {
         return (rand()%201)-100;
       }

Any idea on how can I evaluate a given board configuration ?

1 Answers
Related