TheNinth

Badly Witten Script

Jun 15th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. a = {10,10,0,0}
  2.  
  3. c = {1000,100,10,1}
  4.  
  5. function find(table,value)
  6.    for i=1,4 do
  7.       if table[i]==value then
  8.          return i
  9.       end
  10.    end
  11. end
  12.  
  13. function minimum(table)
  14.    return math.min(math.min(math.min(table[1],table[2]),table[3]),table[4])
  15. end
  16.  
  17. function choke(value,min,max)
  18.    return math.max(math.min(max, value),min)
  19. end
  20.  
  21. function relent()
  22.    b = {200*(1-1.2^c[1])/(1-1.2)*1.2^a[1],
  23.       1000^choke(10-a[1],0,10)*10000*(1-2.2^c[2])/(1-2.2)*2.2^a[2],
  24.       1000^choke(10-a[2],0,10)*100000*(1-2.2^c[3])/(1-2.2)*2.2^a[3],
  25.    1000^choke(10-a[3],0,10)*1000000*(1-2.2^c[4])/(1-2.2)*2.2^a[4]}
  26. end
  27.  
  28. relent()
  29.  
  30. d = {"bullets 1000 times", "explosions 100 times", "railgun 10 times","mouse once"}
  31.  
  32. function calculate()
  33.    e = find(b,minimum(b))
  34.    return "Upgrade "..d[e].." to "..a[e]+c[e]
  35. end
  36.  
  37. function outputs()
  38.    print(calculate())
  39.    a[e]=c[e]+a[e]
  40.    relent()
  41. end
  42.  
  43. for i=1,48 do
  44.    outputs()
  45. end
Advertisement
Add Comment
Please, Sign In to add comment