Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#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