Still the same.

Here is all my code, maybe you'll find something wrong:

Negamax function (think it's all good for this one)

int IA_NegaMaxAlphaBeta(int profondeur, int alpha, int beta, int grille[LIGNES][COLONNES], int emplacements[COLONNES], int colonne, int emplacement, int joueur)
{
int x = COLONNES/2, y, i, k = 1, nbAlign;
nbAlign = check(grille, emplacements, colonne, emplacement, joueur);
if (nbAlign == 4)
{
return -1000;
}
if (GrillePleine(emplacements))
{
return SCORE_NUL;
}
if (profondeur == 0)
{
return IA_Evaluation(grille, joueur, nbAlign);
}
for(i = 0; i < COLONNES && alpha < beta; i++)
{
x += i*k;
k = -k;
if (emplacements[x] > -1)
{
y = InsererJeton(grille, emplacements, x, joueur);
alpha = max(alpha, -IA_NegaMaxAlphaBeta(profondeur-1, -beta, -alpha, grille, emplacements, x, y, joueur^1));
AnnulerJeton(grille, emplacements, y, x);
}
}
return alpha;
}

The eval function (maybe the way i've returned the score is wrong ?)

int IA_Evaluation(int grille[LIGNES][COLONNES], int joueur, int nbAlign)
{
int x, y, colscore, rowscore, score = 0;
for(y = 0; y < LIGNES; y++)
{
rowscore = abs((LIGNES/2) - y);
rowscore = (LIGNES/2) - rowscore;
for(x = 0; x < COLONNES; x++)
{
colscore = abs((COLONNES/2) - x);
colscore = (COLONNES/2) - colscore;
if (grille[y][x] == 0)
{
score -= (rowscore + colscore);
}
else
{
if (grille[y][x] == 1)
{
score += (rowscore + colscore);
}
}
}
}
if (nbAlign == 3)
{
if (joueur == 0)
{
score -= SCORE_3J;
}
else
{
score += SCORE_3J;
}
}
else
{
if (nbAlign == 2)
{
if (joueur == 0)
{
score -= SCORE_2J;
}
else
{
score += SCORE_2J;
}
}
else
{
if (nbAlign == 1)
{
if (joueur == 0)
{
score -= SCORE_1J;
}
else
{
score += SCORE_1J;
}
}
}
}
if (joueur == 0)
{
return score;
}
return -score;
}

And the initial call to negamax (you've suggested a minus sign on negamax but i can't find that anywhere, it's every time without minus sign when it's initial call).

However, i have to make something strange just before calling negamax (insert coin "joueur^1" instead of "joueur" and that's not logic).

This is the initial code as right now:

int x = COLONNES/2, y, i, k = 1, scoreCoup, scoreMeilleur = -INFINI, col = -1;
for(i = 0; i < COLONNES; i++)
{
x += i*k;
k = -k;
if (emplacements[x] > -1)
{
y = InsererJeton(grille, emplacements, x, joueur^1);
scoreCoup = IA_NegaMaxAlphaBeta(MAXPROFONDEUR, -INFINI, INFINI, grille, emplacements, colonne, emplacement, joueur);
if (scoreCoup > scoreMeilleur)
{
scoreMeilleur = scoreCoup;
col = x;
}
AnnulerJeton(grille, emplacements, y, x);
}
}

**Edited by Giustino, 25 May 2012 - 04:39 AM.**