## Thursday, July 31, 2014

### Programming Tangrams using Pro-Bot

This is a comprehensive programming project spanning over 4 hours, that aims to teach the key concepts that can be introduced via Pro-Bot (namely sequential programming, Repeat Loops and Procedures) while applying them to geometrical concepts that are covered in the classrooms.
We shall make use of the famous tangram puzzles for this assignment. Let us take a quick look at what tangrams are and then talk about how to write programs for Pro-Bot to create them.

### Tangrams:

The tangram is a dissection puzzle consisting of seven flat shapes, called tans, which are put together to form shapes. The objective of the puzzle is to form a specific shape (given only an outline or silhouette) using all seven pieces, which may not overlap. It is reputed to have been invented in China and is one of the most popular dissection puzzles in the world.(Wikipedia)

Research shows that tangrams are helpful for developing an intuitive sense of geometry and developing visual-spatial skills. Tangrams have both geometric and artistic features. They help with classifying shapes, understanding the spatial rotation of shapes, understanding fractions, understanding the properties of various shapes including angles, area, perimeter, etc.

To create a tangram, a square is divided up into 16 equal squares. Diagonal lines are drawn to produce 7 shapes. The seven pieces (numbered in the above picture) are:
2 large right triangles  (A, D)
1 medium right triangle (E)
2 small right triangles (C, G)
1 square (F)
1 parallelogram (B)

Some of the properties of the tans (puzzle pieces) are:
1. The large triangle is twice the area of the medium triangle.
2. The medium triangle, the square, and the parallelogram are each twice the area of a small triangle.
3. Each angle of the square measures 90 degrees.
4. Each triangle contains a 90 degree and two 45 degree angles (isosceles right triangles).
5. The parallelogram contains two 45 degree and two 135 degree angles.
The relationships among the pieces enable them to fit together to form many figures and arrangements.

Now that we have taken a look at tangrams, let us write programs for Pro-Bot to draw the tangram puzzles.

We shall start by writing simple sequential programs to generate the seven individual puzzle pieces of the tangram. Then, we shall modify some of those programs to use Repeat Loops. We may also take a look at developing a generalized algorithm for drawing regular polygons (polygons with all sides equal and all angles equal) using Pro-Bot. Next, we shall learn to store programs for the individual puzzle pieces as Procedures in Pro-Bot’s memory, and then “call” them within programs that draw more complex tangram puzzles.

Note that the programming questions are given in the order of increasing complexity, starting with simple polygons, then combining two or three of those to create compound figures and finally, creating complex tangram puzzles that use all seven pieces.

### Programming Assignment:

Given a large square of sides 14 cm each, divide it into sections as shown in the figure below and create the 7 pieces of a tangram. Find the dimensions for each of the seven pieces. Make suitable modifications to the dimensions so that they can be used by Pro-Bot. Write programs to draw each piece separately using Pro-Bot. Finally, draw simple/complex tangram puzzles using Pro-Bot, making use of the programs that you wrote for the 7 tans/puzzle pieces.

Computer Science concepts involved:  Sequential programming, Repeat loops, Procedures/Sub-routines

Math concepts involved:  Polygons (Quadrilaterals, Triangles), Measurement, Fractions, Decimals, Rounding of decimal numbers, Angles, Trigonometry, Area, Perimeter, Congruence, Symmetry

Hours required:  4 or more

Lesson Plan:

Hour 1:   Introduce Pro-Bot and tangrams.

Allow the students to get familiarized with the Pro-Bot and its control panel. Introduce tangrams. Find out the dimensions of the 7 pieces in the tangram puzzle. Use sequential programming to create each of the 7 pieces in the tangram.

 14 cm side square divided into 16 equal parts,  with the diagonals drawn to create the seven puzzle pieces

• On a piece of paper, draw a square of sides 14 cm each.
• Divide this 14 cm side square into 16 equal squares and trace all 7 shapes, using the above diagram as your guide.
• For the right triangles, either calculate the hypotenuse using the mathematical formula or measure it using a ruler.
• Find the dimensions of the square and the parallelogram.
• Can you figure out what fraction of the large square is taken up by each of the seven puzzle pieces?
• Check to see if the dimensions obtained for the sides of the seven puzzle pieces are whole numbers or decimals. If they are decimal numbers, think about whether decimals can be used with Pro-Bot. If not, how can you adjust these numbers to work with Pro-Bot?
• Once you have adjusted the dimensions so that they work on Pro-Bot, write programs to draw the puzzle pieces using Pro-Bot.
• You can see that some of the puzzle pieces are congruent. Hence, you need to write the program only once for each set of congruent shapes.
• Test your programs on Pro-Bot, one at a time to see if you get the desired results for each shape.

Hour 2:    Introduce Repeat Loops on Pro-Bot.
• Now that all the puzzle pieces have been drawn using sequential programming, show how the programs for the square and the parallelogram can be rewritten using Repeat Loops in Pro-Bot.
• Write programs for drawing a few regular polygons using Pro-Bot (polygons with all sides equal and all angles equal) such as pentagon, hexagon, etc. Show how Repeat Loops can be used to write programs for these figures. Develop a generalized algorithm (a set of steps for solving a problem) for drawing regular polygons using Pro-Bot.

Hour 3:    Introduce Procedures on Pro-Bot. Draw compound figures that use a subset of the seven puzzle pieces.
• Store the program for each puzzle piece as a Procedure on Pro-Bot. Since the puzzle pieces would be used multiple times in the project, it makes it easier for you as the programmer, to write the program for each puzzle piece just once, store it as a Procedure and re-use it multiple times.
• Work on a few compound figures that use a combination of just two or three of the puzzle pieces. Call the procedures for the individual puzzle pieces while writing programs for the compound figures.

A.   Write programs for Pro-Bot to draw the following compound figures that use the square and a small triangle from the tangram.

B.   Write programs for Pro-Bot to draw the following compound figures that use the parallelogram and two small triangles from the tangram.

C.   Your class is planning to do a gardening project. You have decided to grow spinach in an area measuring 12.5 square feet and carrots in 25 square feet. The two designs that you are considering for the garden are the ones in Question A above. Would you choose the square or the triangle part of the garden for the carrots? If the cost of fencing the garden is \$5 per foot, which design would you choose so that the cost of fencing can be minimized.

D.   Your school has decided to pursue more vegetable gardening projects. This time, the plan is to grow tomatoes and peppers in spaces of equal area and carrots in a space that is double the area of tomatoes. The garden designs being considered are the ones in Question B above. Determine which vegetable would go in the parallelogram part of the garden and which ones would go in the triangles. How many square feet each of tomatoes, peppers and carrots can be grown? If the cost of fencing the garden is \$5 per foot, which design would you choose so that the cost of fencing can be minimized.

E.   Can you make a trapezoid using just two pieces from the tangram? Write a program to draw your trapezoid using Pro-Bot.

F.   Can you make a parallelogram using just two pieces from the tangram? Write a program to draw your parallelogram using Pro-Bot.

G.   In each of the compound figures that you worked with, can you see the relationship between the angles of the puzzle pieces that allows them to fit together seamlessly?

Hour 4:    Write programs to draw complex tangram figures using Pro-Bot, using all seven puzzle pieces. You can choose either option A or option B.

Option A:
Create geometric shapes using all seven puzzle pieces of the tangram. Write programs for Pro-Bot that uses some of the Procedures for the puzzle pieces to draw the following figures. Compare the areas and perimeters among the complex figures that you create.

A.   Can you make a square that uses all 7 of the tangram pieces? Write a program to draw your square using Pro-Bot.

B.   Can you make a triangle that uses all 7 of the tangram pieces? Write a program to draw your triangle using Pro-Bot.

C.   Can you make a trapezoid that uses all 7 of the tangram pieces? Write a program to draw your trapezoid using Pro-Bot.

D.   Can you make a parallelogram that uses all 7 of the tangram pieces? Write a program to draw your parallelogram using Pro-Bot.

E.   How many squares can you make using some or all of the tangram puzzle pieces?

Option B:

You can find hundreds of artistic tangram puzzles on Google. Choose the designs that are the most interesting to you and work with them. Write programs for Pro-Bot that uses some of the procedures for the puzzle pieces to draw the figures that you choose.

Here is an example. Can you write a program for Pro-Bot to draw this figure, using some of the procedures that you previously created for the tangram pieces?