Efficiency in FieldsofValor.lua

Post Reply
Zedingo
Developer
Posts: 85
Joined: Tue Aug 14, 2012 12:24 pm

Efficiency in FieldsofValor.lua

Post by Zedingo » Thu Aug 23, 2012 1:41 pm

I'm still working on Grounds of Valor, but in researching what all I'll need, I came across getRegimeReward. My IT friend isn't on, so I can't ask him whether 13 checks is better than a 146 element array, so what say you to this:

Code: Select all

function getRegimeReward(regimeid)
	rewards = {270, 285, 300, 315, 330, 390, 475, 500, 525, 550, 540, 570, 600, 630, 670, 270, 285, 300, 315, 330, 540, 570, 600, 630, 690, 270, 285, 300, 315, 330, 450, 475, 500, 525, 550, 540, 570, 600, 630, 690, 630, 665, 700, 810, 855, 900, 945, 990, 900, 950, 1000, 1050, 1100, 330, 575, 480, 330, 660, 330, 575, 660, 270, 285, 300, 315, 330, 360, 420, 450, 630, 650, 700, 730, 270, 285, 300, 315, 330, 340, 360, 380, 400, 670, 710, 740, 800, 270, 285, 300, 315, 330, 315, 370, 475, 710, 710, 730, 770, 350, 400, 450, 1300, 1320, 1340, 1390, 1450, 810, 830, 870, 950, 970, 900, 940, 980, 1020, 1100, 1300, 1330, 1360, 1540, 1540, 820, 840, 860, 880, 920, 940, 1000, 920, 980, 1020, 1080, 1140, 1220, 1260, 1300, 1450, 1500, 1550, 1600, 1600};
	if (rewards[regimeid] ~= nil) then
		return rewards[regimeid];
	else
		return 10;
	end
end

Metalfiiish
Developer
Posts: 176
Joined: Tue Jul 31, 2012 7:21 am

Re: Efficiency in FieldsofValor.lua

Post by Metalfiiish » Sun Oct 07, 2012 8:58 am

bump. Anyone able to answer this?

bluekirby0
Developer
Posts: 707
Joined: Sun Jul 22, 2012 12:11 am

Re: Efficiency in FieldsofValor.lua

Post by bluekirby0 » Fri Oct 12, 2012 12:43 pm

If I was more familiar with LUA I might be able to answer this but generally a B-tree will be more efficient than an indexed list for random access.

Post Reply