/src/

class="hl kwa">end combine.add_lever_topdown = curry(add_lever, 2) combine.add_lever_leftright = curry(add_lever, 1) --[[ Seven-segment display -1- 6 2 -7- 5 3 -4- --]] local sevenseg_digits = { ["0"] = {1, 2, 3, 4, 5, 6}, ["1"] = {2, 3}, ["2"] = {1, 2, 4, 5, 7}, ["3"] = {1, 2, 3, 4, 7}, ["4"] = {2, 3, 6, 7}, ["5"] = {1, 3, 4, 6, 7}, ["6"] = {1, 3, 4, 5, 6, 7}, ["7"] = {1, 2, 3}, ["8"] = {1, 2, 3, 4, 5, 6, 7}, ["9"] = {1, 2, 3, 4, 6, 7}, } function combine:add_str7seg(x0, y0, tw, th, str, fill) --[[ w and h (as width/height of individual (horizontal) segments) have the following properties: tw = n(w+3h)-h th = 2w+3h --]] local len = #str local h = (2*tw-len*th)/(3*len-2) local w = (th-3*h)/2 local ws = w+3*h local segs = { {h, 0, w, h}, {w+h, h, h, w}, {w+h, w+2*h, h, w}, {h, 2*(w+h), w, h}, {0, w+2*h, h, w}, {0, h, h, w}, {h, w+h, w, h}, }