Assignment 6 - Square Fill
Example Output
Learning Outcomes
- Conditions
- Loops
Goals
The purpose of this assignment is to learn to
- Manipulate a ColorGrid object.
- Generate colorful squares
You will generate a visualization that looks like in the figure aboce.
Description
Task
You will be drawing Square Fill using the following logic: (examples provided below.)
- Start with an empty canvas.
- Repeat the following steps.
- Search the canvas for an empty pixel.
- Set the pixel to a random color.
- If the surrounding square of pixels are empty and not outside the canvas continue otherwise go back to step 1.
- Color the surrounding square of pixels with a color.
- Expand the square by 1 and repeat step 3.
- Stop once the canvas is fully colored in.
Extensions
Help
For Java
ColorGrid documentation
Color documentation
Bridges class documentation
For C++
ColorGrid documentation
Color documentation
Bridges documentation
For Python
ColorGrid documentation
Color documentation
Bridges documentation