# Math Help - Help! I can't figure out the expression i need for making a videogame.

1. ## Help! I can't figure out the expression i need for making a videogame.

ok, heres what needs to happen and what i got so far...
the game starts with 6 enemies (E) and after those 6 are dead, the next round starts, but this time with 9 enemies. the enemies are multiplied by 1.5 each round. also round up for example- 9 times 1.5 is 13.5(round up to 14) all of this will go at an infinite loop, but i dont know how id even write that out. let me know if i need to provide any more info!

its not necessarily an infinite LOOP, but an infinite CLIMB.

2. $E_1=6~\&~n\ge2,~E_n=\left\lceil {1.5 \cdot E_{n - 1} } \right\rceil$. That is the ceiling function.

3. what is N?

4. That is call a recursively defined function. $E_n$ is the number of enemies at the start of the $n^{th}$ game.
$E_1=6,~E_2=9,~\cdots~E_{10}=243$.

5. oh ok. and i really dont understand this. sorry, can you explain all the parts? like why you subtract a 1 or have n greaterthan or = to 2

6. Is this a game that *you* are making? If so, why does it have to be exactly 1.5? Why not just make it even like 2? Just curious.

Second here is some possible sudo code:

Integer num_enemies := 6
LOOP {
num_enemies := ROUND_UP(num_enemies * 1.5)
... cool game stuff goes here
}

The code just describes exactly what you said.

7. theres one problem with setting it to 2 instead of 1.5... the game would be impossible the enemies doubling each round is too hard for the player

8. Actually 1.5 * 1.5 = 2.25, so your enemies would more than double every two rounds anyway.
Anytime you multiply, you will get exponential growth.
If you want to make it easy, perhaps you can just add 6 enemies each round:
num_enemies := num_enemies + 6