
From this discussion some minimal code variants:
1
d = Join[Table[{0, -1, 0}, 6], Table[{1, 0, 0}, 8],
Table[{0, 1, 0}, 4], {{-1, 0, 0}}];
c = FoldList[Cuboid[#1[[1]] + #2, #1[[2]] + #2 + {0, 0, 0.5}] &,
Cuboid[{0, 0, 0}, {1, 1, 3}], d];
Graphics3D[c, ViewPoint -> c[[-1, -1]] + {-2, -1, -2.5},
ViewProjection -> "Orthographic"]
2
f[p_, s_] := MapIndexed[Cuboid[#, {#[[1]] + 1, #[[2]] + 1, 3 + s (#2[[1]] - 1) 3/14}] &, p];
Graphics3D[{{f[{{0, 0, 0}, {0, 1, 0}, {0, 2, 0}, {-1, 2, 0}}, 1]},
{f[{{0, 0, 0}, {-1, 0, 0}, {-2, 0, 0}, {-3, 0, 0}, {-4, 0, 0}, {-5, 0, 0},
{-5, 1, 0}, {-5, 2, 0}, {-5, 3, -1}, {-5, 4, -1}, {-5, 5, -2}}, -1]}
},Boxed -> False,ViewProjection -> "Orthographic",ViewPoint -> {1, -1, 1}]
Animation for education and classrooms:
Clear["Global`*"];
x = {1, 0, 0}; y = {0, 1, 0}; z = {0, 0, 1};
cube = Cuboid[{0, 0, 0}, {0, 0, 0} + {1, 1, 3}];
move[{dir_, diff_}][cube_] :=
Cuboid[cube[[1]] + dir, cube[[2]] + dir + diff*z];
type = {i, j, k, l} = {7, 9, 5, 3}; (* i>k>1,j>l>2 *)
dirs = Join[Table[-y, i - 1], Table[x, j - 1], Table[y, k - 1],
Table[-x, l - 2]];
(*dirs={-y,-y,-y,-y,-y,x,x,x,x,x,y,y,-x}*)(*The special case in Wiki*)
diffs = RandomReal[{.2, .8}, Length@dirs];
cubes = FoldList[move[#2][#1] &, cube, Thread[{dirs, diffs}]];
p1 = cube[[-1]] - RandomReal[{.2, .8}]*z;
p2 = cubes[[-1, -1]] + dirs[[-1]];
viewpoint = p2 - p1;
Manipulate[
Graphics3D[{cubes, AbsolutePointSize[4], Point[p1], Red, Point[p2],
Arrowheads[Medium], Thickness[.003],Arrow[{p2, p1}]},
ViewPoint -> RotationTransform[θ, {0, 0, 1}][viewpoint],
ViewProjection -> "Orthographic", Lighting -> "Neutral",
Boxed -> False, ImageSize -> Large, SphericalRegion -> True,
Background -> Black,
(*ViewCenter -> {{0.5`, 0.5`, 0.5`}, {0.5`, 0.53}},*)
Epilog -> {StandardRed, Opacity[.75],Text[Style["Penrose stairs", 55,FontFamily->"Phosphate"], Scaled[{0.5,.95}]]}],
{θ, 0, 2 π}
]