Clear["`*"]

Manipulate[Graphics[HilbertCurve[n]],{n,1,10,1}]

cups[curve_]:=With[{part=Partition[First[curve],UpTo[5],4]},
Graphics[Apply[{{Thick,Line[#1]},{Dashed,Line[#2]}}&,Map[Partition[#,UpTo[4],3]&,part],{1}]]]

Row[{cups[HilbertCurve[1]],cups[HilbertCurve[2]]},Spacer[40]]

color[curve_,n_:1]:=With[{color=ColorData[97,"ColorList"],data=First[cups[curve]]},
Graphics[MapIndexed[{color[[First[#2]]],#1}&,Partition[data,n]]]]

Row[{color[HilbertCurve[2]],color[HilbertCurve[3],4]},Spacer[40]]

g[x_]:= Piecewise[{{2x,x<.5},{2-2x,x≥.5}}]

Manipulate[Plot[Nest[g,x,n],{x,0,1}],{n,1,10,1}]