Is it possible to write a formula for this?

36 Views Asked by At

Hi I have been struggling to write an equation/formula for a few hours. This is not a school or work assignment it is just for fun. Any help would be appreciated.

In this situation, two values, score and time, are used to calculate a final score

I have 3 sets of examples:

slow = ( [score:1354, time: 145], [score:460, time:31] )

medium = ( [score: 958, time: 35.6], [score: 329, time:11] )

fast = ( [score: 603, time: 22.4], [score: 212, time: 8] )

the indices of slow, medium, and fast, all represent a respective end-point in my game. So the first pair in each set all end at the same place but they reached there in different times, and due to a problem, there scores are different. I want it so that the extra time they took is accounted for and penalizes them. So for the first pair of each set, I want it to produce a final score that is highest for the lowest time. This equation should also produce the same result for the second pair of each set; since those also all end at the same respective location. I also would like it if the values stayed positive.

For example, for the first pair in each set if they had scores of

slow = 100

medium = 200

fast = 300

that would be great, and it would work if the same equation on the second pair in each set created:

slow = 10

medium = 20

fast = 30

so far I have tried stuff like this. I don't have a math education so I'm thinking it needs to be exponential, right?:

final score = score - time^(time*.009999)

Could anyone let me know if this is possible? Thank you