嘿,我的搜索树有这个结构
class State
{
//CLASS STATE
int value;
char[][] state; //the game Grid
State child[]; // children of current state, maximum is 8
State(char[][] src)
{
state=src;
child=new State[8];
}
这是根节点定义
State rootNode = new State(currentGrid);
rootNode.value=-1;
int v =maxValue(rootNode,depth);
在最大值函数中的递归结束后,不应编辑 rootNode 中的数组,因为它是第一个状态,但是当我显示它时,我得到一个充满东西的数组,这意味着 rootNode.state 通过引用传递给最大值功能 :(
//我正在尝试实现 MiniMax 算法。