Recursive programming

Winterbay

Active member
I'm trying to write a script that will check for which marbles I have and how many and figure out what to do with them and as far as I can tell I would need to do some recursive checking in order to optimize the combining and testing against market values.

Any tips on how to go about it?
 

Bale

Minion
Interesting problem, but recursion isn't necessary. It is cool though. I'd build a map of all marbles and their prices weighted by how many of them it takes to create a big bamboozler. Multiplying the prices like that would give you a better idea of how expensive they really are.
 

heeheehee

Developer
Staff member
Interesting problem, but recursion isn't necessary. It is cool though. I'd build a map of all marbles and their prices weighted by how many of them it takes to create a big bamboozler. Multiplying the prices like that would give you a better idea of how expensive they really are.

Heck, prices wouldn't even need to be weighted -- just use autosell price!
 

Bale

Minion
No, that's reversed. The smaller ones need to have a higher weight to offset the fact that it takes sooo many of them to add up while the more expensive ones have a higher weight. The correct formula for a marble's useful value would be: mall_price() * (1025- autosell_price()). Those green peewees are expensive because you'd need to purchase more of them.
 

Winterbay

Active member
Ahh, yes. Good suggestion. It turns out that the best marble is in fact the smallest one (green peawee marble) followed by the second largest one (black catseye marble).

On a side note it can be seen that if you want to get one big bumboozer marble from green peawee marbles you have to pay a little over 400k more than if you just bought the darn marble in the first place...

Edit: Also, good that you gave me another way to go than the recursive way because I remember having a hard time grasping the concept when I studied programming 8 years ago :)
 
Top