Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
* (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) Dn = {} Dn[0] = {""} Dn[1] = {"V"} calcDn = function (n) Dn[n] = {} for _,s in ipairs(Dn[n-2]) do tinsert(Dn[n], "H"..s) end for _,s in ipairs(Dn[n-1]) do tinsert(Dn[n], "V"..s) end end for i=2,12 do calcDn(i) end PP(Dn[1]) PP(Dn[2]) PP(Dn[3]) PP(Dn[4]) PP(Dn[5]) PP(Dn[6]) PP(Dn[7]) PP(Dn[8]) PP(Dn[9]) PP(Dn[10]) PP(Dn[11]) PP(Dn[12]) -- replace = function (left, h, v, right linha1 = function (s) return " "..string.gsub(s, "[HV]", {H="____", V="__"}):sub(2).." " end linha2 = function (s) return "|"..string.gsub(s, "[HV]", {H="___|", V=" |"}) end linha3 = function (s) return "|"..string.gsub(s, "[HV]", {H="___|", V="_|"}).." "..s end PD = function (domino) for _,f in ipairs{linha1, linha2, linha3} do print(f(domino)) end end PD "HVVHH" for _,d in ipairs(Dn[1]) do PD(d) end for _,d in ipairs(Dn[2]) do PD(d) end for _,d in ipairs(Dn[3]) do PD(d) end for _,d in ipairs(Dn[4]) do PD(d) end for _,d in ipairs(Dn[5]) do PD(d) end for _,d in ipairs(Dn[6]) do PD(d) end -- -- ___________ -- |___|___|___| -- |___|___|___| HHH -- ___________ -- |___|___| | | -- |___|___|_|_| HHVV -- ___________ -- |___| |___| | -- |___|_|___|_| HVHV -- ___________ -- |___| | |___| -- |___|_|_|___| HVVH -- ___________ -- |___| | | | | -- |___|_|_|_|_| HVVVV -- _________ ___________ -- |___|___| | | |___|___| | -- |___|___|_| HHV |_|___|___|_| VHHV -- _________ ___________ -- |___| |___| | |___| |___| -- |___|_|___| HVH |_|___|_|___| VHVH -- _________ ___________ -- |___| | | | | |___| | | | -- |___|_|_|_| HVVV |_|___|_|_|_| VHVVV -- _______ _________ ___________ -- |___|___| | |___|___| | | |___|___| -- |___|___| HH |_|___|___| VHH |_|_|___|___| VVHH -- _______ _________ ___________ -- |___| | | | |___| | | | | |___| | | -- |___|_|_| HVV |_|___|_|_| VHVV |_|_|___|_|_| VVHVV -- _____ _______ _________ ___________ -- |___| | | |___| | | | |___| | | | | |___| | -- |___|_| HV |_|___|_| VHV |_|_|___|_| VVHV |_|_|_|___|_| VVVHV -- ___ _____ _______ _________ ___________ -- |___| | |___| | | |___| | | | |___| | | | | |___| -- |___| H |_|___| VH |_|_|___| VVH |_|_|_|___| VVVH |_|_|_|_|___| VVVVH -- _ ___ _____ _______ _________ ___________ -- | | | | | | | | | | | | | | | | | | | | | | | | | | | -- |_| V |_|_| VV |_|_|_| VVV |_|_|_|_| VVVV |_|_|_|_|_| VVVVV |_|_|_|_|_|_| VVVVVV -- > for _,d in ipairs(Dn[6]) do PD(d) end >