fixed complexity
This commit is contained in:
parent
31e1e2cb5f
commit
509c027b74
@ -23,7 +23,6 @@ public class AlphaBetaPlayer extends Player{
|
|||||||
Pair<Point, Point> bestMove = null;
|
Pair<Point, Point> bestMove = null;
|
||||||
for(Pair<Point, Point> move : game.getMove(game.getCurrentPlayer())) {
|
for(Pair<Point, Point> move : game.getMove(game.getCurrentPlayer())) {
|
||||||
State nextState = game.play(move);
|
State nextState = game.play(move);
|
||||||
complexity++;
|
|
||||||
int value = -alphabeta(nextState, this.depth,Integer.MIN_VALUE,Integer.MAX_VALUE);
|
int value = -alphabeta(nextState, this.depth,Integer.MIN_VALUE,Integer.MAX_VALUE);
|
||||||
if (value > bestValue) {
|
if (value > bestValue) {
|
||||||
bestValue = value;
|
bestValue = value;
|
||||||
@ -40,6 +39,7 @@ public class AlphaBetaPlayer extends Player{
|
|||||||
else{
|
else{
|
||||||
for (Pair<Point, Point> move : state.getMove(state.getCurrentPlayer())) {
|
for (Pair<Point, Point> move : state.getMove(state.getCurrentPlayer())) {
|
||||||
State nextState = state.play(move);
|
State nextState = state.play(move);
|
||||||
|
complexity++;
|
||||||
alpha = Math.max(alpha,-alphabeta(nextState,depth-1,-beta,-alpha));
|
alpha = Math.max(alpha,-alphabeta(nextState,depth-1,-beta,-alpha));
|
||||||
if(alpha >= beta)
|
if(alpha >= beta)
|
||||||
return alpha;
|
return alpha;
|
||||||
|
Loading…
Reference in New Issue
Block a user