找传奇、传世资源到传世资源站!

a星寻路 算法示例源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

from clipboardusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AStar{ class Program { static void Main(string[] args) { matrix Matrix = new matrix(7, 3); Node startNode = new Node(2,2,0,new Node()); Node endNode = new Node(6, 2, 0, new Node()); Node obstalNode1 = new Node(4, 1, 0, new Node()); Node obstalNode2 = new Node(4, 2, 0, new Node()); Node obstalNode3 = new Node(4, 3, 0, new Node()); Dictionary<string, Node> obstalDic = new Dictionary<string,Node>(); obstalDic.Add(obstalNode1.getKey(), obstalNode1); obstalDic.Add(obstalNode2.getKey(), obstalNode1); obstalDic.Add(obstalNode3.getKey(), obstalNode1); Astar astar = new Astar(startNode, endNode, Matrix, obstalDic); astar.AStar(); astar.getShortCutRoute(); Console.Read(); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复