Java中用于Minimax算法的树表示 [英] Tree representation in java for minimax algorithm

查看:91
本文介绍了Java中用于Minimax算法的树表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Java中实现Minimax算法. 我找不到很好的树表示形式.有没有现成的,或者我应该自己做?

I want to implement the Minimax algorithm in java. I couldnt find a good tree representation. Is there an existing one or should I make my own?

  • 顺便说一句,这是针对吃豆子游戏的 谢谢
  • by the way this is for the pacman game Thanks

推荐答案

您不需要一个.

经常用树来说明minimax算法.

The minimax algorithm is frequently illustrated with a tree.

但是,该树表示算法选择最佳移动所采取的步骤.它不是算法所拥有的数据结构.

However, that tree represents the steps taken by the algorithm to choose the best move. It is not a data structure held by the algorithm.

相反,您将使用 iteration 递归.在树的每个内部节点上,您将遍历子级,并对每个子级使用递归.

Instead, you'll use iteration and recursion. At each interior node of the tree, you'll iterate through the children, and use recursion on each child.

这篇关于Java中用于Minimax算法的树表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆