91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4.26MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-28
  • 語言: C#
  • 標簽: C#??A*??路徑搜索??

資源簡介

詳細描述見我的一篇博文 http://blog.csdn.net/davied9/article/details/51921723

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.IO;

///?本程序主要的完成目標為:
/// 導入地圖數據(2維矩陣,每個元素表示該位置的類型)
/// 0?可通行?1?墻面?2?起始點?3?終止點
/// 輸出尋址結果(估價結果、尋址結果)

namespace?PathSearch
{
class?Program
{
///?
///?玩成地圖尋址功能(A*逆向搜索),作為結果備份,所以完整抄錄
///?

///?
static?void?Main(string[]?args)?//?string?中僅含有一個有效參數,就是地圖文件的文件名
{
Map?mapRead;
if?(1?==?args.Length)
mapRead?=?new?Map(args[0]);
else
return;
if(mapRead.empty)
{
System.Diagnostics.Debug.WriteLine(“PathSearch.Program.Main?>>>?File?read?FAILED!!!“);
return;
}
Coord2?beginNode?=?new?Coord2(1?1);
Coord2?endNode?=?new?Coord2(5?7);
if?(!(mapRead.IsInMap(beginNode)?&&?mapRead.IsInMap(endNode)))
{
System.Diagnostics.Debug.WriteLine(“PathSearch.Program.Main?>>>?Map-file?is?not?available!!!“);
return;
}
Coord2?sizeMap?=?new?Coord2(mapRead.Size());
List?openList?=?new?List();
MapData?cost?=?new?MapData(sizeMap?costInitValue);
Coord2[]?NSOffsets?=?new?Coord2[8]
{
new?Coord2(-1-1)new?Coord2(?0-1)new?Coord2(?1-1)
new?Coord2(-1?0) new?Coord2(?1?0)
new?Coord2(-1?1)new?Coord2(?0?1)new?Coord2(?1?1)
};
int[]?NSPrice?=?new?int[8]
{
141014
10???10
141014
};
Coord2?currentNode?=?new?Coord2(endNode);
cost[currentNode]?=?0;
Coord2?checkNode?=?new?Coord2();
openList.Add(currentNode);//?注意區別
int?nodePrice?=?0;
Coord2?minSpaceNode?=?new?Coord2();
int?minSpaceCost?=?0; //?節點空間中估價最小的節點
while(0?!=?openList.Count)
{
openList.Remove(currentNode);
for(int?ix_Space?=?0;?ix_Space? {
checkNode?=?currentNode?+?NSOffsets[ix_Space];
if?(!mapRead.IsInMap(checkNode))?continue;
if?(costInitValue?!=?cost[checkNode]?||?mapRead.IsObs(checkNode))?continue;
nodePrice?=?NSPrice[ix_Space];
cost[checkNode]?=?cost[currentNode]?+?nodePrice;
if?(beginNode?==?checkNode)?goto?search_tag;
openList.Add(new?Coord2(checkNode));//?注意區別
}
minSpaceNode?=?openList.ElementAt(0);
minSpaceCost?=?cost[minSpaceNode];
foreach(Coord2?minCheckNode?in?openList)
{
if(?cost[minCheckNode]? {
minSpaceNode?=?minCheckNode;
minSpaceCost?=?cost[minSpaceNode];
}
}
currentNode?=?minSpaceNode;
}
search_tag:
if?(costInitValue?==?cost[beginNode])
{
System.Diagnostics.Debug.WriteLine(“PathSearch.Program.Main?>>>?Path?NOT?found!!!“);
return;
}
List?pathList?=?new?List();
currentNode?=?new?Coord2(beginNode);
while?(endNode?!=?currentNode)
{
pathList.Add(new?Coord2(currentNode));
minSpaceNode?=?currentNode;
minSpaceCost?=?cost[currentNode];
foreach(Coord2?offset?in?NSOffsets)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????193??2016-07-16?13:24??PathSearchPackages\Map.txt

?????文件???????8555??2016-07-16?13:23??PathSearchPackages\Program.cs

?????文件????4606146??2016-07-16?11:40??PathSearchPackages\whole.jpg

?????目錄??????????0??2016-07-16?13:25??PathSearchPackages

-----------?---------??----------?-----??----

??????????????4614894????????????????????4


評論

共有 條評論