Creating Grids
Top-Down Design
Top-Down Design
This is a series of Turtle Programming projects that focuses on building user-created functions, incorporating top-down design principles, and iterating through projects to create more efficient and more flexible code.
[Hidden]
Review these code samples:
Reflect on these questions:
Which code sample is easiest to read? What makes it the easiest to read?
Which code sample is the hardest to read? What makes it hard? What could be done to make it easier to read?
Which of these code sample would be easiest to extend to draw a 5x5 grid. How about a 10x10 grid? What if you would have to draw a 200 x 500 grid?
Let's try extending the code from one of the code samples above to try to solve a new problem. Follow these directions:
Select one the code samples from the last step.
Remix the project so you can edit it.
Modify the program so that when the program runs the turtle draws a 4x4 grid instead of a 3x3 grid. Attempt to do this by changing as little of the original code as possible.
Run the program below:
After running the program. Click on the code and see if you can figure out how it works.
After investigating the code, reflect on these questions:
What different structures to you notice in this code compared to the previous samples?
What is different about how the code is organized?
How difficult do you think it would be to extend this code to create a 4x4 grid? Do you think it would be easier or harder than adapting the samples from Step 1?
[Hidden]
For this challenge, you are going to create a program that could create any grid size combinations. There are two challenges to this activity.
[Hidden]
Create a program that could configure any size grid from 2x2 - 9x9. Note that grids do not need to be square. Grids can come in sizes like 2x5 or 5x2 as well as 5x5.
Moving forward the first number will represent the number of columns and the second number will represent the number of rows.
[Hidden]
In the second part of the challenge, you are going to modify your program so that not only can you make flexible grid sizes but you can also specify the size of the square (in pixels). So you can make 3x6 grid with large squares or a 6x3 grid with small squares.
Your program must be able to make grids with squares as small as 5px and as large as 50px.
[Hidden]