这是我的代码:
private int minvalue(char [] brd){
int m = (int) Integer.MAX_VALUE;
int v;
ArrayList<Integer> action = actions(brd);
for(int i = 0; i < action.size(); i++){
int a = action.get(i);
char [] nextbrd = result(brd, a, human);
if(status(nextbrd)=='C')
v = maxvalue(nextbrd);
else
v = utility(nextbrd);
m = Math.min(v, m);
}
return m;
}
private int maxvalue(char [] brd){
int m = (int) Integer.MIN_VALUE;
int v;
ArrayList<Integer> action = actions(brd);
for(int i = 0; i < action.size(); i++){
int a = action.get(i);
char [] nextbrd = result(brd, a, agent);
if(status(nextbrd)=='C') //if the game is not yet over
v = minvalue(nextbrd);
else
v = utility(nextbrd);
if(v==Math.max(m, v))
nextAction = a;
m = Math.max(m, v);
}return m;}
这会产生堆栈溢出错误。我多次查看我的代码但是 我不知道出了什么问题。是因为这两个函数互相调用了很多次吗?我应该使用线程吗?请帮帮我