Algebraic Equations + JASS

Sneakster

Active Member
Reaction score
24
I am very much so a GUI map-maker for Warcraft, and have been for a long time. I want start implementing some JASS into my maps, and so to help me understand JASS better, I wanted to know how a simple algebraic equation could be translated into JASS.

An equation would be something simple, like:

Your Gold: 500
Rate you gain gold: 10gold per 6 seconds
Cost of Building: 600

How much gold do you need to build the building?

500 + 10x = 600
10x = 100
x = 10 gold per 6 seconds

Obviously, I think almost everyone could do that in their head. I'm just wondering, how would you convert a mathematical equation like this into a form of JASS code?

Thanks.
 

millz-

New Member
Reaction score
25
I don't quite get what you mean by that, do you want to calculate how much more gold you need to build a certain building?
 

Romek

Super Moderator
Reaction score
964
This should be something like what you want, or at least give you an idea:
JASS:
function Equation takes real x returns real
    return 500 + (10 * x)
endfunction
 

Cookiemaster

New Member
Reaction score
36
500 + 10*x = 600
10*x = 100
x = 10 gold


a + c*x = b (assuming value's a, b and c are given.)
c*x = d
x = d

b - a = d
d / c = x
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top