Module:SB tree: Difference between revisions

Ganaram inukshuk (talk | contribs)
Added comments to code
Ganaram inukshuk (talk | contribs)
No edit summary
Line 7: Line 7:
-- Start and stop ratio may be any two ratios, but the default values are 1/1 and 1/0
-- Start and stop ratio may be any two ratios, but the default values are 1/1 and 1/0
-- Depth may be specified to be any value, but the default is 4
-- Depth may be specified to be any value, but the default is 4
-- Edge extend recursively finds the mediants of the first two and last two ratios; default is 0
-- Edge extend iteratively finds the mediants of the first two and last two ratios; default is 0
-- Transpiled from python to lua with aid of ChatGPT; may need testing to make sure code works
-- Transpiled from python to lua with aid of ChatGPT; may need testing to make sure code works
function p.sb_tree(depth, start_ratio, stop_ratio, edge_extend)
function p.sb_tree(depth, start_ratio, stop_ratio, edge_extend)
Line 63: Line 63:
result = result .. "! Ratio\n"
result = result .. "! Ratio\n"
local sb_tree_ratios = p.sb_tree(4, {1, 1}, {1, 0}, 0)
local sb_tree_ratios = p.sb_tree()
for i = 1, #sb_tree_ratios
for i = 1, #sb_tree_ratios