From: Mason Kelsey Date: 2009-10-01T05:50:38+09:00 Subject: Control of Priority Queue Order? And size limits on queues? --00032557b58ac66e0e0474d1ae60 Content-Type: text/plain; charset=ISO-8859-1 I've successfully used the Priority Queue to sort ascending items for solving the 8-puzzle problem. I noticed that the Priority Queue method had a unique way of sorting items with matching keys. It puts the newest items furtherest from the top. The older a matching item is, the further it is towards the top. That is OK by me as it essentially added a negative g(n) node value to the h(n) heuristic value that aided in the A* best-first algorithm. If the newest matching item had been added at the top, it would have slowed the program down by going down fruitless paths and probably would create a less optimal path to the results. The code I used was: open_queue = PQueue.new(proc{|x,y| x[0]