Priority Queue, Skew Heap, Fibonacchi heap for A* pathfinder

toto8080

Villager
Member
Joined
Feb 26, 2018
Messages
15
Reaction score
0
First Language
German
Primarily Uses
RMVXA
I would like to optimise my A* pathfinder by storing it's open list in a priority queue. As far as I know, Ruby - and RGSS3 - does not have a priority queue implementation in its standard library.

Sadly, I'm not an expert in scripting, so I would really appreciate, if somebody could help me with this one.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
'Scripts' is where people who have written completed scripts that they want to share with others can post them.

[move]Learning Ruby and RGSSx[/move]
 

toto8080

Villager
Member
Joined
Feb 26, 2018
Messages
15
Reaction score
0
First Language
German
Primarily Uses
RMVXA
I already read this article, but the problem is, that I also have to use the 'default' Array methods (each, include?, empty?) in my script on the same array, so I can't just change it to this PriorityQueue, since I'm not enough good in coding and I cannot write these core methods myself. :/

I tried to simply just direct my sorted data (via PriorityQueue) to a simply Array, do the necessarily methods on the 'simple Array' then convert it back to a PriorityQueue. But I bumped an other error this way.. I also tried to subclass the Array class but that also hit a dead end and with the given error I'm not sure why.
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
Try this then. Add this script to your project: https://github.com/rubyworks/pqueue/blob/master/lib/pqueue.rb

It has built-in methods for things like ‘empty?’ and ‘include?’, and if there’s anything you still absolutely need and it doesn’t have, then you can use ‘to_a’ to get a sorted array to work on. Having programmed an A* Star search myself, I can say that this implementation has everything you need to make it work.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top