NegaMax Algorithm and TicTacToe…What's wrong?

时光毁灭记忆、已成空白 提交于 2019-12-03 20:30:31

In a NegaMax framework the evaluation function has to look different. Try following evaluation function:

int evaluateNegaMax(GameBoard* board)
{
    if (board->turn == MAXPLAYER)
        return evaluate(board);
    else
        return -evaluate(board);
}

The chessprogramming site explains why:

In order for negaMax to work, your Static Evaluation function must return a score relative to the side to being evaluated

Shouldn't

game_board_toggle_player(board);

be

game_board_toggle_player(copy);

?

The usual error is to start with MIN at each level rather than passing values down the tree. I haven't studied your code in detail to compare with the paradigmatic negamax algorithm, but it seems that you may be making that error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!