Lab 3.5: Row of Houses
Unit 1, Lab 3.5
In this project, you’ll use abstractions inside of abstractions to build a row of houses.
When you finish, make sure to
“U1L35-Row-of-Houses”
Create a
draw square
block that takes a size as input. Be sure to test it with different inputs.You learned how to create a block with an input on Lab 3 Page 3: Blocks with Inputs.
Using
draw
square as an example of where to start, create and test adraw triangle
block that takes a size as input and draws an equilateral triangle.You learned about turning angles on Unit 1, Lab 3, Page 2, Angles and Turning.
Now, use
draw square
anddraw triangle
together to create adraw house
blocks that takes a size as input and draws a house shape: a square with a triangular shaped roof sitting on top.You might have to do some debugging to get the two shapes to connect properly.
Using a block inside another block is a form of abstraction.
Use your
draw house
block together withrepeat
to create adraw row of houses
block that draws a row of number attached houses (each of the same size) with each new one to the right of the previous.Use your
draw row of houses
block together withrepeat
to create adraw group of houses
block that draws a rows by cols amount of houses (each of the same size) in one place with each row below the previous row.
We learned about the pick random
block on Unit 1, Lab 2, Page 5: Adding Variety to Gossip
.
It is a reporter block that reports a random number within the range of numbers that you specify.
- Use your
draw group of houses
block together withrepeat
andpick random
to create adraw town of houses
block that draws a groups number of groups of houses all of a random amount of houses (each of the same size) in random places (try to make sure they don’t overlap!)
Houses aren’t really stuck next to each other like in the examples that we gave! Edit the
draw row of houses
anddraw group of houses
block so that there are gaps between the houses.Customize the look of your houses by editing the code of your
draw house
block. Things that you can add to the houses include:- Windows, doors, garages, greenery, etc.
- Consider breaking it down first. e.g., create a block
draw window
that only draws a window then add the block into thedraw house
block.
Create a better way of generating groups of houses. Edit
draw group of houses
so that it usespick random
to create a group of houses that can have houses missing (i.e. make it look more “natural”)
-
Use your
draw square
block to create adraw flower with square petals
block that will draw a flower with square petals with any specified number of petals of the specified size.
-
Now, draw a field of flowers and give each flower a different size, number of petals, and position.
You will need to use .
After you’ve worked on this for a bit, take a moment to look at what others have done. If you see something you like, think how you could use that idea in your program.
Make sure to turn in your project!