The three rules of Ruby Q.:
Please do not post any solutions or spoiler discussion for this quiz
48 hours have passed from the time on this message.
Support Ruby Q. by submitting ideas as often as you can:
Suggestion: A [QUIZ] in the subject of emails about the problem helps
on Ruby T. follow the discussion. Please reply to the original quiz
if you can.
by Drew O.
When I learned about fractals in high school math class, I immediately
them fascinating. For those of you unfamiliar with the concept, the
from Wikipedia is as follows: a fractal is “a rough or fragmented
shape that can be subdivided in parts, each of which is (at least
a reduced-size copy of the whole”.
At the end of the unit in which we were taught them, the fractal below
test question. In subsequent years, I began drawing it freehand to
higher levels. The details and patterns that emerge are fascinating.
The goal is to create a ruby program which takes the level as an
then draws the fractal shown below to the specified level. The fractal
created by drawing the first level, then repeating the pattern such that
base piece is replaced with the fractal from the higher level. Thus, to
from level 1 to level 2, we replace each line with the shape at level 1.
that the position changes as well, meaning if the line is vertical we
with a vertically positioned shape of level 1 (right and left facing
matter). I have shown the first 3 levels below (including the base
level 0). Feel free to use the console for output or get fancy with
_ <-- Level 0 _ _| |_ <-- Level 1 _ _| |_ _| |_ <-- Level 2 _|_ _|_ _| |_| |_| |_ _ _| |_ _| |_ _|_ _|_ _| |_| |_| |_ _| |_ _|_ _|_ _| |_| |_| |_ <-- Level 3 _| |_ _|_ _|_ _| |_|_ _ _ _|_| |_ _| |_|_|_| |_|_|_| |_ _|_ _|_|_ _|_|_ _|_
| || || || || || || |