Skip to content

Instantly share code, notes, and snippets.

@nst
Last active October 20, 2022 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nst/e48011d8c355ad340b9dba5506edcdf5 to your computer and use it in GitHub Desktop.
Save nst/e48011d8c355ad340b9dba5506edcdf5 to your computer and use it in GitHub Desktop.
%!PS
<< /PageSize [780 600] >> setpagedevice
/S 5 def % step height
% draw one face of a brick
/f {
/M exch def
/C exch def
/h exch def
/w exch def
gsave
M concat
C setgray
0 0 w h rectfill
0 setgray
0 0 w h rectstroke
grestore
} def
% draw one brick, all 3 faces
/b {
/H exch def
/W exch def
gsave
W H 2 div 0.8 [ 1 0 -1 1 0 S ] f
W S 1 [ 1 0 0 1 0 0 ] f
H 2 div S 1 [ -1 1 0 1 0 0 ] f
grestore
} def
% Up, Down, Left, Right
/U { /H2 exch def { H 2 div neg H 2 div S add translate W H2 b } repeat } def
/D { /H exch def { H 2 div H 2 div neg S sub translate W H b } repeat } def
/L { /W2 exch def { W2 neg S neg translate W2 H b } repeat } def
/R { /W2 exch def { W S translate W2 H b } repeat } def
/W 30 def
/H 30 def
100 200 translate
2 30 L
2 30 D
save
12 5 D
1 60 D
1 265 R
9 10 R
4 5 R
restore
2 30 R
1 30 U
1 60 U
1 60 R
1 60 U
5 10 R
1 30 R
1 60 R
save
5 20 D
save
10 5 L
restore
save
18 5 D
restore
10 5 R
restore
10 10 R
1 60 R
save
20 10 D
1 60 D
10 5 R
1 110 R
restore
save
10 10 U
1 60 U
10 20 R
restore
save
10 10 R
1 60 R
20 10 D
restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment