Lab 1⃣.1⃣

Geometric Fun Timesβ„’

In this lab, you will write your first SNAP programs to draw some simple shapes on the stage.

1. Drawing a square

1.1) Write a SNAP script that draws a square when the number 1 is pressed on the keyboard. Remember that each corner of a square is a 90Β° angle.

1.2) Add code so that the sprite says the word β€œsquare” while it is drawing. The sprite should stop saying β€œsquare” once it has finished drawing the square.

1.3) Add code so that pressing the spacebar clears the pen marks from the stage.

Comment your code explaining your work.

2. Adding more shapes

2.1) Now that you’ve drawn a square, add code to draw the shapes in the following table. Each shape should be drawn when the number next to it is pressed on the keyboard. (For example, pressing 3 on the keyboard should draw a diamond.)

When this key is pressed... Draw a ...
1 Square
2 Equilateral triangle
3 Diamond
4 Pentagon
5 Parallelogram ("leaning rectangle")
6 5-pointed star

You will probably want to draw a sketch of each to figure out the angles in each shape.

2.2) Add code so that as each shape is being drawn, the sprite is saying the name of shape. The sprite should stop saying the name of the sprite when it is finished drawing.

2.3) Modify your code so that each different shape is drawn in a different color and with a different line thickness. So, for example, if the square is drawn in blue with a line thickness of 3, each other shape must be drawn in a color that is not blue and with a line thickness that is not 3. You can choose whatever colors your want.

2.4) Add code so that the sprite is hidden when it is not drawing. This is will make sure that the sprite is not obstructing the view of your beautiful artwork!

3) Comment your code! What did you do? Where did you get stuck? How did you fix it?