Module:TTPoints

local p = {}

function p._PointsTable(args)

-- Initialize the table local tbl = mw.html.create('table') :addClass('wikitable sortable') :css('text-align','center')

tbl:tag('th') :wikitext('Difficulty') tbl:tag('th') :wikitext('Level') tbl:tag('th') :wikitext('Turns') tbl:tag('th') :wikitext('Teams lost') tbl:tag('th') :wikitext('Maps cleared') tbl:tag('th') :wikitext('Score')

diff={ {8,"Normal",3,25}, {14,"Normal",3,30}, {20,"Normal",3,35}, {25,"Hard",4,35}, {30,"Hard",5,35}, {35,"Lunatic",5,40}, {40,"Lunatic",7,40} }   speed={{1.5,"28-","A"},{1.4,"29-31","B"},{1.3,"32-35","C"},{1.2,"36-39","D"},{1.1,"40+","E"}} survival={{1.2,0,"A"},{1.15,1,"B"},{1.1,2,"C"},{1.05,3,"D"}}

for d=1, #diff do       for sp=1, #speed do            for sv=1, #survival do                for t=1, diff[d][3] do

basescore=diff[d][4] score=basescore*t*survival[sv][1]*speed[sp][1]*1.4

local tr = tbl:tag('tr')

tr:tag('td') :wikitext( diff[d][2] ) tr:tag('td') :wikitext( diff[d][1] ) tr:tag('td') :wikitext( speed[sp][2] ) tr:tag('td') :wikitext( survival[sv][2] ) tr:tag('td') :wikitext( t ) tr:tag('td') :wikitext( score ) end end end end return tostring(tbl) end

function p.PointsTable(frame) return p._PointsTable end

return p