 # Math - Algebra 101 - Challenge

In this lecture we looked at how to convert a design problem into an algebraic expression and then manipulate it in order to solve for different values.

For your challenge, our designer wants to make our fuel to last for 120 seconds.
To do this, we can adjust the maxFuel and/or burnRate.

You task is to rearrange our equation and solve for maxFuel [m] and burnRate [b].

currentFuel [c] = maxFuel [m] - (burnRate [b] * time [t])

With burnRate of 2 then maxFuel needed would be 240
With maxFuel of 100 burnRate needed would be 5/6 or .83333

1 Like

m = bt + c
m = b120 + 0
m = 120b

b = m - c / t
b = m - 0 / 120
b = m / 120

1 Like

float maxFuel = 100;
float currentFuel = 0;
float time = 120;
float burnRate;

burnRate = (maxFuel - currentFuel) / time;

burnRate = 0.8333333;

OR

float maxFuel;
float currentFuel = 0;
float time = 120;
float burnRate = 2;

maxFuel = -burnRate * -time + currentFuel;

maxFuel = 240;

1 Like

c = m - (b * t)
m = (b * t) - c
(b * t) = m - c
b = (m-c) / t

for t = 120 and c = 0

if m is still 100
b = (100-0) / 120
b = 100 / 120
b = 5/6 = 0.8333…

if b is still 2
m = (2 * 120) - 0
m = 2 * 120
m = 240

1 Like

For the current problem I was able to rework the equations to be:

m = bt + c

and

b = (c-m) / -t

For fun: b = .833 and m = 240

1 Like

Here’s how I calculated it:

time elapsed = (max fuel - current fuel) / burn rate

To calculate the max fuel needed:

120 = (max_fuel - 0) / 2
120 = max_fuel / 2
max_fuel / 2 * 2 = 120 * 2
max_fuel = 120 * 2
max_fuel = 240

To calculate the burn rate needed:

120 = (100 - 0) / burn_rate
120 * burn_rate = 100 / burn_rate * burn_rate
(120 * burn_rate) = 100
(120 * burn_rate) / 120 = 100 /120
burn_rate = 0.83333

I expanded the names of the variables for clarity.

1 Like

So, rearranging the equation gave me:

m = (b * t) + c, or Max fuel = (burn rate multiplied by time) plus current fuel

and

b = (m - c) / t, or Burn rate = (max fuel minus current fuel) / time

So, a burn rate of 1 unit per second and a max fuel of 120 units would yield 120 seconds before the player ran out of fuel. Any scaled version of this would work too.

If the designers insisted that the max fuel be 100 units, then the burn rate would be 5/6 units per second, or ~0.833.

1 Like

Here’s my take on the challenge. I hope I didn’t make a mistake 1 Like

c=m −(b ∗t)

m=c+(b∗t)

c=m−(b∗t)

c−m=−bt
(c−m)/t=−b

b=−(c−m)/t

m=c+(b∗t)
m=0+(2∗120)
m=240

b=−(c−m)/t
b=−(0−100)/120
b= 0.8333

1 Like

Either maxFuel is 240 or burnRate is 5/6 (0.833333)

1 Like

I hope to to be in the right way, this is my solution

i assume that burnRate(b) = 2, time (t) = 120 and currentFuel© = 0, so my implementation is

m = c + (b * t)
m = 0 + (2 * 120)
m = 240

b = c - m / -t
b = 0 - 240 / -120
b = -240 / -120
b = 2