擅长:python、mysql、java
<p>首先谈谈调试:如果要打印递归调用中完成的计算,可以跟踪问题的执行情况并快速找到答案</p>
<p>但是,你的问题似乎是最重要的。在minimax调用中,如果当前播放器为X,则调用该状态的每个子级的max_值,然后取该结果的max。但是,这会在树的顶部应用max函数两次。游戏中的下一个玩家是O,所以你应该为下一个玩家调用minu值函数</p>
<p>因此,在minimax调用中,如果当前_播放器为X,则应调用minu value;如果当前_播放器为O,则应调用max_value</p>