亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? astarlibrary - demo 3 (4 way).bb

?? A STAR 算法源碼, 比較初級的算法, 適合初學的朋友研究
?? BB
?? 第 1 頁 / 共 2 頁
字號:
	;If not a wall/obstacle square.
	If walkability(a,b) <> unwalkable 
	
	;If not already on the open list, add it to the open list.			
	If whichList(a,b) <> onOpenList	

		;Create a new open list item in the binary heap.
		newOpenListItemID = newOpenListItemID + 1; each new item has a unique ID #
		m = numberOfOpenListItems+1
		openList(m) = newOpenListItemID	 ;place the new open list item (actually, its ID#) at the bottom of the heap
		openX(newOpenListItemID) = a : openY(newOpenListItemID) = b ;record the x and y coordinates of the new item
			
		;Figure out its G, H and F costs and parent
		Gcost(a,b) = Gcost(parentXval,parentYVal)+10		
		Hcost(openList(m)) = 10*(Abs(a - targetx) + Abs(b - targety)) ; record the H cost of the new square
		Fcost(openList(m)) = Gcost(a,b) + Hcost(openList(m)) ;record the F cost of the new square
		parentX(a,b) = parentXval : parentY(a,b) = parentYVal	;record the parent of the new square	
		
		;Move the new open list item to the proper place in the binary heap.
		;Starting at the bottom, successively compare to parent items,
		;swapping as needed until the item finds its place in the heap
		;or bubbles all the way to the top (if it has the lowest F cost).
		While m <> 1 ;While item hasn't bubbled to the top (m=1)	
			;Check if child's F cost is < parent's F cost. If so, swap them.	
			If Fcost(openList(m)) <= Fcost(openList(m/2)) Then
				temp = openList(m/2)
				openList(m/2) = openList(m)
				openList(m) = temp
				m = m/2
			Else
				Exit
			End If
		Wend 
		numberOfOpenListItems = numberOfOpenListItems+1 ;add one to the number of items in the heap

		;Change whichList to show that the new item is on the open list.
		whichList(a,b) = onOpenList


;8.	If adjacent cell is already on the open list, check to see if this 
	;path to that cell from the starting location is a better one. 
	;If so, change the parent of the cell and its G and F costs.	
	Else; If whichList(a,b) = onOpenList
	
		;Figure out the G cost of this possible new path
		tempGcost = Gcost(parentXval,parentYVal)+10
		
		;If this path is shorter (G cost is lower) then change
		;the parent cell, G cost and F cost. 		
		If tempGcost < Gcost(a,b) Then 	;if G cost is less,
			parentX(a,b) = parentXval 	;change the square's parent
			parentY(a,b) = parentYVal
			Gcost(a,b) = tempGcost 	;change the G cost			

			;Because changing the G cost also changes the F cost, if
			;the item is on the open list we need to change the item's
			;recorded F cost and its position on the open list to make
			;sure that we maintain a properly ordered open list.
			For x = 1 To numberOfOpenListItems ;look for the item in the heap
			If openX(openList(x)) = a And openY(openList(x)) = b Then ;item found
				FCost(openList(x)) = Gcost(a,b) + HCost(openList(x)) ;change the F cost
				
				;See if changing the F score bubbles the item up from it's current location in the heap
				m = x
				While m <> 1 ;While item hasn't bubbled to the top (m=1)	
					;Check if child is < parent. If so, swap them.	
					If Fcost(openList(m)) < Fcost(openList(m/2)) Then
						temp = openList(m/2)
						openList(m/2) = openList(m)
						openList(m) = temp
						m = m/2
					Else
						Exit ;while/wend
					End If
				Wend 
				
				Exit ;for x = loop
			End If ;If openX(openList(x)) = a
			Next ;For x = 1 To numberOfOpenListItems

		End If ;If tempGcost < Gcost(a,b) Then			

	End If ;If not already on the open list				
	End If ;If not a wall/obstacle cell.	
	End If ;If not already on the closed list	
	End If ;If not off the map.	
	Next

;9.	If open list is empty then there is no path.	
	Else
		path = nonExistent : Exit
	End If

	;If target is added to open list then path has been found.
	If whichList(targetx,targety) = onOpenList Then path = found : Exit		

	Forever ;repeat until path is found or deemed nonexistent
	
	
;10.	Save the path if it exists. Copy it to a bank. 
	If path = found
		
		;a. Working backwards from the target to the starting location by checking
		;each cell's parent, figure out the length of the path.
		pathX = targetX : pathY = targetY	
		Repeat
			tempx = parentX(pathX,pathY)		
			pathY = parentY(pathX,pathY)
			pathX = tempx
			unit\pathLength = unit\pathLength + 1	
		Until pathX = startX And pathY = startY
	
		;b. Resize the data bank to the right size (leave room to store step 0,
		;which requires storing one more step than the length)
		ResizeBank unit\pathBank,(unit\pathLength+1)*4

		;c. Now copy the path information over to the databank. Since we are
		;working backwards from the target to the start location, we copy
		;the information to the data bank in reverse order. The result is
		;a properly ordered set of path data, from the first step to the
		;last.	
		pathX = targetX : pathY = targetY				
		cellPosition = unit\pathLength*4 ;start at the end	
		While Not (pathX = startX And pathY = startY)			
			PokeShort unit\pathBank,cellPosition,pathX ;store x value	
			PokeShort unit\pathBank,cellPosition+2,pathY ;store y value	
			cellPosition = cellPosition - 4 ;work backwards		
			tempx = parentX(pathX,pathY)		
			pathY = parentY(pathX,pathY)
			pathX = tempx
		Wend	
		PokeShort unit\pathBank,0,startX ;store starting x value	
		PokeShort unit\pathBank,2,startY ;store starting y value

	End If ;If path = found Then 


;11. Return info on whether a path has been found.
	Return path; Returns 1 if a path has been found, 2 if no path exists. 

;12.If there is no path to the selected target, set the pathfinder's
	;xPath and yPath equal to its current location and return that the
	;path is nonexistent.
	.noPath
	unit\xPath = startingX
	unit\yPath = startingY
	Return nonexistent

End Function
	

;==========================================================
;READ PATH DATA: These functions read the path data and convert
;it to screen pixel coordinates.
Function ReadPath(unit.unit)			
	unit\xPath = ReadPathX(unit.unit,unit\pathLocation)
	unit\yPath = ReadPathY(unit.unit,unit\pathLocation)
End Function

Function ReadPathX#(unit.unit,pathLocation)
	If pathLocation <= unit\pathLength
		x = PeekShort (unit\pathBank,pathLocation*4)
		Return tileSize*x + .5*tileSize ;align w/center of square	
	End If
End Function	

Function ReadPathY#(unit.unit,pathLocation)
	If pathLocation <= unit\pathLength
		y = PeekShort (unit\pathBank,pathLocation*4+2)
		Return tileSize*y + .5*tileSize ;align w/center of square		
	End If
End Function


;This function checks whether the unit is close enough to the next
;path node to advance to the next one or, if it is the last path step,
;to stop.
Function CheckPathStepAdvance(unit.unit)
	If (unit\xLoc = unit\xPath And unit\yLoc = unit\yPath) Or unit\pathLocation = 0
		If unit\pathLocation = unit\pathLength 
			unit\pathStatus = notstarted	
		Else 		
			unit\pathLocation = unit\pathLocation + 1
			ReadPath(unit) ;update xPath and yPath
		End If	
	End If	
End Function

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜视频网站| 在线免费观看视频一区| 欧美日韩国产美| 午夜精品一区在线观看| 欧美一三区三区四区免费在线看 | 亚洲3atv精品一区二区三区| 91极品美女在线| 欧美激情一二三区| 国产一区二区在线视频| 国产精品国产三级国产aⅴ无密码| 99精品黄色片免费大全| 亚洲国产乱码最新视频| 欧美写真视频网站| 国产一区二区不卡| 亚洲午夜免费视频| 久久久久久久综合| 欧美夫妻性生活| 美女精品一区二区| 亚洲欧美日韩系列| 日韩一级免费观看| 欧美乱妇15p| av成人免费在线| 狠狠狠色丁香婷婷综合激情 | 精品国产青草久久久久福利| 51久久夜色精品国产麻豆| 亚洲国产视频a| 国产精品久久久久婷婷 | 久久久久久电影| 国产麻豆成人精品| 狠狠网亚洲精品| 久久99精品久久久久久久久久久久| 国产精品国产三级国产aⅴ原创| 欧美v亚洲v综合ⅴ国产v| 69堂国产成人免费视频| 国产mv日韩mv欧美| 成人黄色片在线观看| 国产在线一区二区综合免费视频| 五月天欧美精品| 精品一区二区免费视频| 国产高清不卡二三区| 欧美视频一区二区三区四区| 精品视频一区 二区 三区| 欧美精品一区二区精品网| 亚洲国产精品高清| 性做久久久久久久免费看| 国内精品久久久久影院薰衣草| 夫妻av一区二区| 欧美色综合久久| 国产欧美一区二区精品性色| 中文字幕色av一区二区三区| 奇米一区二区三区| 成人av网站在线| 欧美一级艳片视频免费观看| 国产精品久久久久影院| 免费在线欧美视频| 欧美日本高清视频在线观看| 久久免费的精品国产v∧| 日韩影院精彩在线| 色婷婷av一区二区三区gif| 久久久久99精品一区| 免费欧美在线视频| 91精品欧美一区二区三区综合在| 国产精品素人一区二区| 国产麻豆成人传媒免费观看| 精品国产三级a在线观看| 日韩成人一级片| 欧美精品色一区二区三区| 亚洲成人手机在线| 欧美视频在线观看一区二区| 玉米视频成人免费看| 欧美色精品在线视频| 亚洲18影院在线观看| 日韩一级高清毛片| 精品一区免费av| 国产精品欧美一级免费| 国产精品99久久久| 五月天亚洲精品| 精品国产乱码久久久久久免费| 韩国成人精品a∨在线观看| 久久婷婷色综合| 欧美日本韩国一区| 国产毛片精品视频| 亚洲精品久久久蜜桃| 69久久夜色精品国产69蝌蚪网| 日韩精品免费专区| 国产精品理论在线观看| 欧美日韩在线播放一区| 激情成人综合网| 亚洲乱码中文字幕| 日韩视频在线观看一区二区| 成人免费视频一区二区| 肉丝袜脚交视频一区二区| 国产精品灌醉下药二区| 欧美肥大bbwbbw高潮| 国产成人免费网站| 另类的小说在线视频另类成人小视频在线| 精品国产一区二区三区av性色| 在线精品视频免费播放| 成人毛片在线观看| 美洲天堂一区二卡三卡四卡视频| 国产日韩欧美不卡| 久久夜色精品国产噜噜av| 欧美三级在线视频| 欧美午夜电影一区| 在线视频一区二区三| 99久久99久久综合| 国产一区二区影院| 国产精品综合一区二区三区| 麻豆91在线播放免费| 夜夜爽夜夜爽精品视频| 精品伦理精品一区| 亚洲精品一线二线三线 | 欧美性欧美巨大黑白大战| 国产成人午夜高潮毛片| 国产精品亚洲第一区在线暖暖韩国| 久久国产日韩欧美精品| 黑人巨大精品欧美一区| 国产一区二区三区免费| 国产精品一区二区三区四区| 懂色av一区二区三区免费看| 91香蕉视频污在线| 欧美三区在线观看| 久久新电视剧免费观看| 中文字幕欧美日韩一区| 中文字幕日韩一区| 久久精品99国产精品日本| 精品无人区卡一卡二卡三乱码免费卡| 琪琪一区二区三区| 97se亚洲国产综合在线| 欧美日韩一二区| 中文字幕亚洲一区二区av在线| 亚洲国产日韩精品| 国产中文字幕精品| 欧美日韩黄视频| 亚洲欧洲日产国产综合网| 日韩高清国产一区在线| 99热国产精品| 国产亚洲精久久久久久| 日本欧美一区二区三区乱码| 国产一区二区网址| 91麻豆精品国产91久久久更新时间| 中文一区二区在线观看| 日本不卡视频一二三区| 欧美日韩黄色一区二区| 亚洲综合一区二区三区| 成人免费高清视频| www精品美女久久久tv| 日本欧美一区二区三区乱码| 欧美在线三级电影| 亚洲国产毛片aaaaa无费看 | 亚洲精品伦理在线| 93久久精品日日躁夜夜躁欧美| 久久久久久久久岛国免费| 精品一区二区三区在线观看 | 日韩欧美资源站| 免费在线观看精品| 欧美男男青年gay1069videost | 一区二区三区精品在线| 欧美艳星brazzers| 一区二区不卡在线播放| 欧美喷水一区二区| 麻豆精品国产传媒mv男同| 久久精品视频免费| 99久久伊人久久99| 日韩精品电影在线观看| 日韩欧美国产一区二区在线播放 | 午夜精品影院在线观看| 欧美午夜精品一区二区蜜桃| 午夜欧美2019年伦理| 6080国产精品一区二区| 日韩不卡一区二区三区| 欧美电视剧免费观看| 国内精品国产成人| 欧美国产在线观看| 在线观看成人小视频| 日本不卡高清视频| 久久无码av三级| 色av综合在线| 国产一区三区三区| 亚洲综合无码一区二区| 精品黑人一区二区三区久久| 国产99久久久国产精品潘金| 一片黄亚洲嫩模| 久久久久久黄色| 欧美裸体bbwbbwbbw| 粉嫩av一区二区三区粉嫩| 亚洲午夜一区二区| 国产精品无码永久免费888| 欧美日韩一区视频| 9i在线看片成人免费| 久久91精品久久久久久秒播| 一级精品视频在线观看宜春院| 久久日一线二线三线suv| 欧美性欧美巨大黑白大战| 波多野洁衣一区| 国产精品中文字幕日韩精品| 精品亚洲国内自在自线福利| 天天免费综合色| 日韩电影在线一区| 亚洲一二三四在线|