Grasp of the Fallen
Grasp of the Fallen / Engines / Artificial Intelligence /


Updated: 6/15/2004

priority queue	Open

  node   n, n', s
	s.cost = 0
	s.parent = null   // s is a node for the start
	push s on Open
	while Open is not empty
		pop node n from Open  // n has lowest cost in Open
		if n is a goal node 
			construct path 
			return success
		for each successor n' of n
			newcost = n.cost + cost(n,n')
			if n' is in Open
			 and n'.cost <= newcost
			n'.parent = n
			n'.cost = newcost
			if n' is not yet in Open
				push n' on Open
	return failure  // if no path found

©2004-2022 - All Rights Reserved. An RPG game under development by Bruce Kirkpatrick | Jetendo CMS | Web Design | Have comments? Email Me