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

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

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

?? 國外的一個A*算法演示
?? 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一区二区三区免费野_久草精品视频
国产98色在线|日韩| 黄色精品一二区| 裸体一区二区三区| 成人app软件下载大全免费| 欧美老女人第四色| 国产精品电影一区二区| 毛片av一区二区| 在线国产电影不卡| 国产精品国产三级国产普通话三级 | 精品国产免费视频| 亚洲黄色在线视频| 粉嫩av一区二区三区| 精品久久人人做人人爱| 樱花影视一区二区| 成人黄页毛片网站| 国产亚洲视频系列| 麻豆国产91在线播放| 欧美日韩久久久久久| 亚洲免费在线观看| 99精品桃花视频在线观看| 国产亚洲欧美日韩在线一区| 美女视频免费一区| 日韩三级av在线播放| 亚洲成人第一页| 欧美日韩在线电影| 亚洲一区中文日韩| 欧美体内she精高潮| 夜夜精品视频一区二区| 色老汉一区二区三区| 亚洲乱码国产乱码精品精小说| 成人一区在线观看| 国产精品你懂的在线| 国产suv一区二区三区88区| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 美日韩黄色大片| 日韩一区二区三区四区 | 亚洲国产精品久久艾草纯爱| 91视视频在线观看入口直接观看www| 国产欧美日韩在线| 99久久伊人久久99| 亚洲视频一区二区在线| 91久久精品日日躁夜夜躁欧美| 亚洲在线免费播放| 4438成人网| 精品一区二区久久久| 欧美精品一区二区久久婷婷| 国产在线乱码一区二区三区| 日韩一级免费观看| 国产成人啪午夜精品网站男同| 亚洲国产精品传媒在线观看| 91视频在线观看| 日日夜夜一区二区| 欧美精品一区二区三区蜜桃视频 | 狠狠色狠狠色综合系列| 亚洲国产电影在线观看| 91免费视频网址| 视频一区欧美精品| 26uuu久久天堂性欧美| 成人a区在线观看| 亚洲男人的天堂av| 欧美一三区三区四区免费在线看| 国产一区二区影院| 一区二区视频免费在线观看| 欧美一区二区三区免费| 成人免费av在线| 日韩精品电影在线| 国产欧美日产一区| 色婷婷综合久久久中文一区二区| 亚洲国产中文字幕在线视频综合| 在线亚洲精品福利网址导航| 免费人成黄页网站在线一区二区| 欧美国产精品专区| 91精品一区二区三区在线观看| 韩国成人精品a∨在线观看| 亚洲欧美乱综合| 精品国产免费人成在线观看| 91丝袜美女网| 玖玖九九国产精品| 一区二区激情视频| www国产精品av| 欧美视频在线观看一区二区| 国产成人精品综合在线观看| 亚洲一区二区三区小说| 国产亚洲精品bt天堂精选| 欧美无乱码久久久免费午夜一区 | 成人免费的视频| 日韩**一区毛片| 亚洲精品一二三四区| 亚洲精品一区二区三区精华液| 欧美色视频一区| 盗摄精品av一区二区三区| 日韩高清在线电影| 亚洲色图制服丝袜| 国产亚洲污的网站| 欧美日本精品一区二区三区| 99re热视频这里只精品| 国产很黄免费观看久久| 午夜精品久久久久久久| 亚洲人精品一区| 国产精品久久午夜| 亚洲国产精品二十页| 久久久国产精品麻豆| 日韩欧美黄色影院| 精品视频一区二区不卡| 在线观看av不卡| 色噜噜夜夜夜综合网| 91在线精品一区二区三区| 国产麻豆午夜三级精品| 精品在线播放午夜| 蜜臀av性久久久久蜜臀aⅴ| 亚洲综合网站在线观看| 亚洲男人都懂的| 亚洲卡通欧美制服中文| 亚洲日本欧美天堂| 亚洲欧洲国产专区| 成人免费在线视频观看| 国产精品久久99| 亚洲桃色在线一区| 一区二区三区在线免费播放| 亚洲码国产岛国毛片在线| 亚洲精品乱码久久久久久黑人 | 欧美精品久久一区| 日本高清不卡视频| 在线观看国产精品网站| 欧美亚洲国产一区二区三区va| 成人午夜免费av| 成人va在线观看| 在线视频观看一区| 91麻豆精品国产| 精品入口麻豆88视频| 久久九九久久九九| 亚洲国产精品成人综合色在线婷婷| 国产精品久久网站| 午夜精品123| 久久国产人妖系列| 粉嫩av一区二区三区粉嫩| 成人黄色大片在线观看| 色综合久久久久综合体桃花网| 91成人免费在线| 欧美一区二区三区在线观看| 欧美一区二区二区| 日本一区二区免费在线观看视频| 国产精品人成在线观看免费 | 欧美日韩精品综合在线| 欧美一级艳片视频免费观看| 国产亚洲成年网址在线观看| 中文字幕在线视频一区| 一区二区三区四区中文字幕| 美腿丝袜在线亚洲一区| av在线免费不卡| 欧美三级资源在线| 国产亚洲一区二区三区四区| 综合亚洲深深色噜噜狠狠网站| 一级女性全黄久久生活片免费| 蜜桃视频第一区免费观看| 国产成+人+日韩+欧美+亚洲| 欧美视频精品在线观看| www久久精品| 亚洲成人动漫一区| 99re成人精品视频| 欧美成人一区二区三区| 亚洲精品一卡二卡| 裸体歌舞表演一区二区| 欧美体内she精高潮| 国产精品成人在线观看| 日本美女视频一区二区| 色综合久久综合中文综合网| 久久免费精品国产久精品久久久久| 一区二区三区免费看视频| 国产老妇另类xxxxx| 欧美日韩国产一级片| 国产精品不卡在线| 国产精品自产自拍| 欧美一区二区三区影视| 一区二区三区在线免费播放 | 国产精品丝袜一区| 久久99久久99小草精品免视看| 日本黄色一区二区| 国产精品理伦片| 国产一区二区三区国产| 日韩午夜av电影| 亚洲成人免费在线观看| 色综合一区二区| 日韩一区日韩二区| 国产精品一区二区久久不卡 | 秋霞国产午夜精品免费视频| 色系网站成人免费| 国产精品久久久久久久裸模| 国产精品综合视频| 久久久三级国产网站| 麻豆国产91在线播放| 69久久夜色精品国产69蝌蚪网| 亚洲综合丁香婷婷六月香| 91蝌蚪porny| 亚洲人成网站在线| 91久久精品一区二区二区| 综合久久久久久| 色婷婷av一区| 亚洲嫩草精品久久| 欧美性一级生活|