views:

189

answers:

1

Alright, so warsow has some pretty excellent hud code with the exception that the math logic is a bit screwy.

Input:

a*b + c*d

Interpreted as:

((d*c) + b) * a

As you can see, the game does a series of operations in reverse order without regard to order of operations. Parentheses do not work in the hud code. It must be a linear series of operations to come up with the end result. Is this possible? I understand that it would be better to implement proper math into the hud code, but this is way more fun imo.

+6  A: 
a*b + a/c*d -> ((d*c/a) + b) * a

granted normal algebra holds

aaa
how do you get from `a*b + c*d` to `a*b + a/c*d`?
aaronasterling
@Aaron its how its interpreted
aaa
I didn't get a chance to test it, since the idea has been dropped. Your answer is much appreciated nevertheless.
mkroman