Module:TAMNAMS: Difference between revisions

Ganaram inukshuk (talk | contribs)
Comments; bugfix for udp
Ganaram inukshuk (talk | contribs)
Added udp function that creates a udp as a string; helper function for various udp-related functions
Line 672: Line 672:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------------------- MODE NOTATION FUNCTIONS ------------------------------
------------------------- MODE NOTATION FUNCTIONS ------------------------------
-------------------------- BASED ON UDP NOTATION -------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Given the number of gens up and down per period and a period count (u, d, and
-- p respectively), construct the UDP as a string, as up|dp(p) or u|d, for
-- multi-period and single-period respectively.
-- If only u is known, then d = p - u - 1.
-- If only d is known, then u = p - d - 1. (Basically, p = u + d + 1.)
function p.udp(gens_up_per_period, gens_down_per_period, periods)
if periods == 1 then
return string.format("%s|%s", gens_up_per_period, gens_down_per_period)
else
return string.format("%s|%s(%s)", gens_up_per_period * periods, gens_down_per_period * periods, periods)
end
end


-- Given an input mos, list the udps for each of its modes, listed in order of
-- Given an input mos, list the udps for each of its modes, listed in order of
Line 685: Line 699:
local gens_down = steps_per_period - gens_up - 1
local gens_down = steps_per_period - gens_up - 1
local udp = ""
local udp = p.udp(gens_up, gens_down, period_count)
if period_count > 1 then
udp = string.format("%s|%s(%s)", gens_up * period_count, gens_down * period_count, period_count)
else
udp = string.format("%s|%s", gens_up, gens_down)
end
table.insert(udps, udp)
table.insert(udps, udp)
end
end
Line 785: Line 794:
-- period mosses, or u|d for single-period mosses.
-- period mosses, or u|d for single-period mosses.
local period_count = mos.period_count(input_mos)
local period_count = mos.period_count(input_mos)
local dark_gens_down_per_period = mos.period_step_count(input_mos) - 1 - bright_gens_down_per_period
local bright_gens_up_per_period = mos.period_step_count(input_mos) - 1 - bright_gens_down_per_period
udp = ""
udp = p.udp(bright_gens_up_per_period, bright_gens_down_per_period, period_count)
if period_count == 1 then
udp = string.format("%s|%s", dark_gens_down_per_period, bright_gens_down_per_period)
else
udp = string.format("%s|%s(%s)", dark_gens_down_per_period * period_count, bright_gens_down_per_period * period_count, period_count)
end
-- Produce the list of alterations, if the mode is for a modmos.
-- Produce the list of alterations, if the mode is for a modmos.
Line 824: Line 828:
output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2))
output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2))
return p.mode_rotation_udps("LLsLsAs", mos.new(5,2), "m")
return p.mode_rotation_udps("LLLsLLs", mos.new(5,2), "m")
--return p.degree_quality({4, -1}, mos.new(5,2), "ABBREV", 'm')
--return p.degree_quality({4, -1}, mos.new(5,2), "ABBREV", 'm')