Nice pic(s), but I cannot decode the method! Best regards, jj * Brad Klee <bradklee@gmail.com> [Sep 28. 2019 17:51]:
AltFWord[let_, n_] := Riffle[Table[let, n], Table["F", n - 1]]
MoveWord[2, "L"] = "+RF-LFL-FR+"; MoveWord[2, "R"] = "-LF+RFR+FL-";
MoveWord[n_, "L"] := If[OddQ[n], "", "+"] <> StringTake[ MoveWord[n - 1, "R"] <> "F-" <> AltFWord["L", n] <> "-" <> AltFWord["R", n][[2 ;; -1]] <> "+", {If[OddQ[n], 2, 1], -1}];
MoveWord[n_, "R"] := If[OddQ[n], "", "-"] <> StringTake[ MoveWord[n - 1, "L"] <> "F+" <> AltFWord["R", n] <> "+" <> AltFWord["L", n][[2 ;; -1]] <> "-", {If[OddQ[n], 2, 1], -1}];
HilbertGen[n_] := {"L" -> MoveWord[n, "L"], "R" -> MoveWord[n, "R"]}
ToVec[str_] := FoldList[Switch[#2, "+", #1*{1, I}, "-", #1*{1, -I}, "F", {Total[#1], #1[[2]]}, _, #1] &, {0, 1}, Characters[str]]
Grid[Transpose@{Function[{n}, Labeled[ Map[Graphics[{Line[ReIm[ToVec[#][[All, 1]]]]}, ImageSize -> 500] &, NestList[StringReplace[#, HilbertGen[n]] &, "L", 2]][[-1]], n] ] /@ Range[2, 10]}, Frame -> All]
Out[]:= https://0x0.st/zvPI.png
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun