Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int Negamax_AlphaBeta(Node node, int d, int alpha, int beta){
- int value;
- int count = 0;
- if(d==0 || node.equals(null)){
- return node.getScore();
- }
- int bestValue = -Integer.MAX_VALUE;
- for(Node child: node.childNode){
- value = -Negamax_AlphaBeta(child, d-1, -alpha, -beta);
- bestValue = Math.max(bestValue, value);
- alpha = Math.max(alpha, value);
- count++;
- if(alpha >= beta){
- break;
- }
- }
- node.setCount(count);
- return bestValue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement