The three rules of Ruby Q.:
Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
Support Ruby Q. by submitting ideas and responses
as often as you can!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. follow the discussion. Please reply to
the original quiz message, if you can.
Flood Fill Visualization (#201)
This week’s quiz comes from Martin DeMello
Flood fill is a simple algorithm that colours in a connected
region of a bitmap. The algorithm looks for all nodes which are
connected to the start node by a path of the target color, and changes
them to the replacement color. (Check out the Wikipedia page for more
While simple, the algorithm is pretty satisfying to watch in action,
which brings us to the quiz: have a program accept a bitmap and a
starting point, and animate the algorithm as it floodfills the region
containing that point.