Priority queue or priority list?

by Tzu

Back to Mechanic's Corner.

Tzu2007-12-02 00:41:22
I'm trying to clean up my curing system and i was thinking if someone done the similar.

Note the coding example: (i'm aware of syntax is diffrent from popular zmud, or mushclient but concept is the same i think)

Priority queue: (made by variable checks in a long checklist on the queue)

/set apply_queue=broken_leg_right
/if (strstr({apply_queue}, "broken_leg_right") >= 0))
/set apply_next=mending to legs %; \\
/elseif <...other afflictions>

Pros: Helps for debugging?
Cons: Is it slow?

Priority list: (made by variables in a long checklist)
/set broken_leg_right=1
/if ({broken_leg_right} == 1) \\
/set apply_next=mending to legs %; \\
/elseif <...other afflictions>

Pros: Faster (is it noticable?)
Cons: Harder to debug, can't just view one variable and print all afflictions swiftly (or not as swift as queue can)

Anyone had any experience by doing this?
Unknown2007-12-02 00:53:31
I use a variable queue, simply because it was easier for me to understand, and I really enjoy working with it. It can be hard to debug, but just throw in print statements anywhere you have a problem.

I've heard people say I should be using a list, because working with variables like that is too messy. However, I've also heard people say that using variables is faster, and more adaptable to odd situations you might have to code for.

Not sure how true any of that is, but it makes me feel better about using a variable queue.
Unknown2007-12-02 13:55:07
Using individual variables for each affliction, defense, and balance in the game can be tedious and makes the system harder to maintain (in my opinion). It can be noticeably faster on certain clients or computers, I will agree.

Using data record variables (in zMUD/CMUD) can be very beneficial, and even string lists have their place. In the latest CMUD beta, both have been optimized for huge increases in efficiency (i.e., speed). Personally, I use data record variables (also known as hashtables or lookup maps) for tracking and string lists for priorities.
Forren2007-12-02 18:49:21
I do what Zarquan does, although I use a string list to store my current afflictions rather than a data record. Every cure in my system is generated from a single data record that is parsed to create a dozen others.