|
| 03 May 2017 07:43 PM |
thisIsYourLevel = 100 previousLvlCreds = {} totalVal = 0
function getTotalCredits(lvl) if lvl ~= 0 then table.insert(previousLvlCreds, (200+5*lvl)) getTotalCredits(lvl-1) else for i, v in ipairs(previousLvlCreds) do totalVal = totalVal + v end end return totalVal end
print(getTotalCredits(thisIsYourLevel))
--[[ you can use this script to feel bad about how much credits you lost for not waiting until the price of the guns went down, and i'm ashamed that this took me 2 hours to make]]
|
|
|
| Report Abuse |
|
|
|
| 03 May 2017 08:19 PM |
Or:
local function getTotalCredits(level) return level * (405 + level * 5) / 2 end
print(getTotalCredits(100))
|
|
|
| Report Abuse |
|
|
| |
|
|
| 04 May 2017 09:40 PM |
i can understand how my script works, even though it's 5 times longer
but i can't understand how your script works, even though it's only 4 lines
:(
|
|
|
| Report Abuse |
|
|
|
| 04 May 2017 09:44 PM |
i need to know how this wizard did his math
|
|
|
| Report Abuse |
|
|
|
| 04 May 2017 09:46 PM |
I CANNOT COMPREHEND THE WAYS OF HIS MAGIC
|
|
|
| Report Abuse |
|
|
|
| 04 May 2017 09:59 PM |
| ok what exactly am i looking at here? is it a summation series? what is it??? what category does this fall in? ok so the credits for a specific level are calculated like this: it's ####### # ############################### X reaches 0 -->> where X is the level for example a table of credits/level values would look like this: ### #### ### #### ### #### ### #### how exactly would this function be expressed in arithmetic/geometric terms? i mean without ROBLOX lua. |
|
|
| Report Abuse |
|
|
|
| 04 May 2017 10:00 PM |
THE FILTER STRIKES AGAIN
i'm done with this
|
|
|
| Report Abuse |
|
|
| |
|
|
| 05 May 2017 10:34 PM |
| How did you manage to put that on a forum post without it bunching up??? |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 05 May 2017 10:38 PM |
| Press preview and edit accordingly ^ |
|
|
| Report Abuse |
|
|
|
| 05 May 2017 10:41 PM |
| Doesn't really help much if the code takes up a line. |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 05 May 2017 11:54 PM |
Oh and,
[200+5*level] + [200+5*(level-1)] + ... + [200+5*1] =
We have 200 lots of level
200*level + 5[level + (level - 1) + ... + 1] =
(Via sum of numbers 1 to n formula)
200*level + 5*[level(level + 1) / 2] =
Factorise out level
level*[200 + 5*(level + 1) / 2] =
Factorise out 1/2
level*[400 + 5*(level + 1)] / 2 = level*[405 + 5*level] / 2 |
|
|
| Report Abuse |
|
|