?
?
package GA_Maze;
/**
* 遗传算法在走迷宫游戏的应用
* @author lyq
*
*/
public class Client {
public static void main(String[] args) {
//迷宫地图文件数据地址
String filePath = "C:\\Users\\lyq\\Desktop\\icon\\mapData.txt";
//初始个体数量
int initSetsNum = 4;
GATool tool = new GATool(filePath, initSetsNum);
tool.goOutMaze();
}
}
?
算法的输出:
我测了很多次的数据,因为有可能会一时半会搜索不出来,我设置了最大遗传次数100次。
?
总