3 ms·
The first line is given in the text as: "... first of which is drawn from a point halfway between a point halfway between the center of the wall and the upper l
by biot 13y ago
The first line is given in the text as: "... first of which is drawn from a point halfway between a point halfway between the center of the wall and the upper left corner and the midpoint of the left side and the upper left corner to a point halfway between the midpoint of the top side and the upper right corner".
Given that the line has a FROM and TO point, we can extract those:
FROM
a point halfway between a point halfway between the center of
the wall and the upper left corner and the midpoint of the left
side and the upper left corner
TO
a point halfway between the midpoint of the top side and the
upper right corner
The "halfway between" in each FROM and TO part must specify two points to be between, so we can extract those:
FROM
a point halfway between:
1. a point halfway between the center of the wall and the upper
left corner and the midpoint of the left side
2. the upper left corner
TO
a point halfway between:
1. the midpoint of the top side
2. the upper right corner
We do this once again for the nested "halfway between":
FROM
a point halfway between:
1. a point halfway between:
a. the center of the wall
b. the upper left corner
c. the midpoint of the left side
2. the upper left corner
TO
a point halfway between:
1. the midpoint of the top side
2. the upper right corner
This results in a nonsensical parsing ("between" can't have three parameters), so we need to backtrack and reconsider other options. This is English and unfortunately the specification isn't precise. The only one that makes sense is therefore:
FROM
a point halfway between:
1. a point halfway between the center of the wall and the upper
left corner
2. [a point halfway between] the midpoint of the left side and
the upper left corner
TO
a point halfway between:
1. the midpoint of the top side
2. the upper right corner
This yields the final definition of the first line:
FROM
a point halfway between:
1. a point halfway between:
a) the center of the wall
b) the upper left corner
2. a point halfway between:
a) the midpoint of the left side
b) the upper left corner
TO
a point halfway between:
1. the midpoint of the top side
2. the upper right corner
I leave this as an exercise to the reader to parse the English using greedy vs. non-greedy regex statements and see which one results in the correct outcome.
- Guillaume86 13y agoI came to the same conclusion. Now I'm expecting someone to make a parser/interpreter and a Sol Lewitt image encoding format using the genetic algorythm that turn images into semi transparent polygons :).
- Guillaume86 13y agoWell I was a bit borred today, I made the Parser/Interpreter part, I can turn the instructions to a SVG document: https://github.com/guillaume86/SolLewitt https://github.com/guillaume86/SolLewitt
- mkl 13y agoI came to this conclusion at first, but I'm pretty sure it's incorrect (blue in [1]). See Camillo's comment[2] about "a point halfway between" being missing, and yohui's reply. I modified my construction to match, and now it seems right (red). [1] http://imgur.com/U0sIlNE http://imgur.com/U0sIlNE (based on my own parsing) [2] https://news.ycombinator.com/item?id=6319414 https://news.ycombinator.com/item?id=6319414