Module:MOS genchain: Difference between revisions

Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
Base functionality complete (the for loops, basically)
Line 24: Line 24:
local bright_gen = mos.bright_gen(input_mos)
local bright_gen = mos.bright_gen(input_mos)
local gens = mos.interval_mul(bright_gen, -num_gens/2)
local gens = mos.interval_mul(bright_gen, -num_gens/2)
local genchain = { mos.equave_reduce(gens, input_mos) }
local genchain = { mos.period_reduce(gens, input_mos) }
for i = 1, num_gens do
for i = 1, num_gens do
gens = mos.interval_add(gens, bright_gen)
gens = mos.interval_add(gens, bright_gen)
table.insert(genchain, mos.equave_reduce(gens, input_mos))
table.insert(genchain, mos.period_reduce(gens, input_mos))
end
end
return genchain
return genchain
Line 33: Line 33:


function p._mos_genchain(input_mos)
function p._mos_genchain(input_mos)
local input_mos = input_mos or mos.new(5,2)
local input_mos = input_mos or mos.new(6,3)
local num_gens = mos.period_step_count(input_mos)
local num_gens = mos.period_step_count(input_mos)
Line 59: Line 59:
result = result .. string.format("%s %s", (i == 1 and "|" or " ||"), tamnams.degree_quality(genchain[i], input_mos, "abbrev"))
result = result .. string.format("%s %s", (i == 1 and "|" or " ||"), tamnams.degree_quality(genchain[i], input_mos, "abbrev"))
end
end
result = result .. "\n|}"
else
else
local mosprefix = "mos"
for i = 1, period_count do
for i = 1, period_count do
--wip
local period_step_count = mos.period_step_count(input_mos)
result = result .. string.format("! Degree quality (%s-%sdegree to %s-%sdegree)\n", period_step_count * (i - 1), mosprefix, period_step_count * i - 1, mosprefix)
for j = 1, #genchain do
local current_interval = genchain[j]
current_interval = mos.interval_add(current_interval, mos.interval_mul(mos.period(input_mos), i - 1))
result = result .. string.format("%s %s", (j == 1 and "|" or " ||"), tamnams.degree_quality(current_interval, input_mos, "abbrev"))
end
result = result .. "\n"
end
end
result = result .. "|}"
end
end