• Create Account

### #Actualalvaro

Posted 15 October 2012 - 09:36 AM

int score = -negamax(nextBoard, depth, Integer.MIN_VALUE+1, Integer.MAX_VALUE-1, sign);

Following the general alpha-beta algorithm, that should actually be
int score = -negamax(nextBoard, depth, Integer.MIN_VALUE+1, -best, sign);

Other than that, the only thing I would have done differently is not having a variable max' at all: You can simply remove all mentions of it and return alpha at the end instead.

EDIT: Wait, why are you passing a sign around?

### #1alvaro

Posted 15 October 2012 - 09:32 AM

int score = -negamax(nextBoard, depth, Integer.MIN_VALUE+1, Integer.MAX_VALUE-1, sign);

Following the general alpha-beta algorithm, that should actually be
int score = -negamax(nextBoard, depth, Integer.MIN_VALUE+1, -best, sign);

Other than that, the only thing I would have done differently is not having a variable max' at all: You can simply remove all mentions of it and return alpha at the end instead.

PARTNERS