Pythagoras Tree
Create an algorithm to use the VR Pen on the VR Robot to draw and color squares on the Art Canvas+ Playground to create a 2-level Pythagoras Tree (please see the image)!
- Select the Art Canvas+ Playground.
- Code the VR Robot to draw squares on the playground to create a 2-level Pythagoras Tree.
- Using the VR Pen, drive the VR Robot to draw a big square at the bottom of the canvas as the trunk of the tree.
- Code the VR Robot to draw a right isosceles triangle with the top edge of the big square as its hypotenuse. And draw two squares along each of the other two sides of this isosceles triangle as the first-level branches of the tree.
- Code the VR Robot to draw right isosceles triangles with the top edge of each first-layer branch square as the hypotenuse. And draw squares along each of the other sides of the isosceles triangles as the second-level branches of the tree.
- Drive the VR Robot into each square and use the [Fill area with color] block to fill it with specific colors to create a Pythagoras Tree!
Helpful Hints
- Use the sine function (or cosine function) and the hypotenuse length of the right isosceles triangle to calculate the equal side lengths.
Equal_side_length = Hypotenuse_length * sin(45°)
- Use the function block from the Operators category and choose the sine function from a list of options to calculate sin(45°).
Matching Python command:
math.sin(45 / 180.0 * math.pi)