# Starmaking – A Programming and/or Geometry project

I have started working on a Star-making activity that has, I think, great potential in a computer programming OR a geometry class. I am currently doing it with my very small computer programming class (though I haven’t figured everything out yet – first time teaching a class and a small willing audience means we can figure it out together) and am working to adapt it to do with my geometry class second semester.

Before I start spewing my ideas, watch this Vi Hart video if you haven’t. Also, if you want to get distracted watching ALL OF HER VIDEOS for a while, that’s no problem. Have fun. I’ll wait here.

So. Fun! Starmaking! It’s good times.There is a lot of math there. And if structured correctly, a lot of algorithmic thinking.

In computer programming, we are using the language Snap! right now. Snap is  an extensively rewritten version of Scratch that has significantly more power and doesn’t use flash (at the cost of prettiness and the social sharing pieces). This activity as we’re doing it right now could easily be done in Scratch itself, though.

Here’s what we’ve done so far:

1. We wrote a Snap program to use a sprite to draw a five-pointed star. The created stars look like this:

The challenges here were:

• Figure out that our little “turtle” sprite could draw this star the same way we draw a star – by walking in one continuous motion
• Find the “turn angle” – the exterior angle that our sprite must turn in order to make each point
• Learn how to use simple loops in Snap
2. We wrote a Snap program to draw  an Any-Odds star. This will draw a star that connects every other point on the Vi Hart style circle. Another way of thinking about it (which helped the girls figure out the formula for the turn angle) was to think of these stars as a regular polygon with triangles drawn above each side. Like these:
T
he challenges here were:

• Find a formula for the turn angle that would work for any number of points (they used isosceles triangles and the regular polygon angle formulas, which is where I think the awesome geometryness really kicks in)
• Figure out how to ask the user how many points they want in Snap
• Figure out how to use the users answers (variables) in formulas and loops

It is important to point out that our system only works for odd stars – with even number of points, it simply draws a regular polygon twice. We did NOT spend a lot of time exploring that yet, though it comes down to mutual-primeness.

3. We are now working on the next phase: drawing the FIRST SHAPE of any star in Vi’s system. The challenges here are:
• Figure out how many sides each shape will have AND how many total shapes there should be (even though our program at this point will only draw one of them). It helps to answer both of these questions at once as they are related (# of shapes * sides in one shape = number of total points).
• The turning angle as a function of n and s.
4. At this point we will be able to encounter our first annoying difficulty: if we specify the length of the sides of the stars in our program, then different types of stars will be radically different in size even with the same specification. That is, a star made with 37 points skipping 3 will be HUGE if the side lenghts are 100 pixels, while a star made with 5 points skipping 2 in that case will be much smaller. I hope to lead the students to realize our life will be better if we decide to specify the diameter of the surrounding circle instead. This means we will need to find a way to calculate the side length of the star using n, s, and the diameter. This requires triangle trig, unless I’m missing a circle conjecture that makes it easier (possible! must consult with geometry teachers who actually understand all of the circle conjectures).
5. Finally, we will add the ability to draw ALL of the shapes in stars, when there are multiple ones. The hardest part here is calculating how to get the sprite to the proper starting point for shape number two. I have worked out at least two ways to do this, and am trying to decide the best way to scaffold it in for the students, especially the geometry students (the programming students i may allow to flounder at this stage a bit, like I did yesterday and today). Eventually, shapes like this will be at our beck and call:

In geometry, after watching the video, I will first have them actually DRAW 4 stars (5 skip 2, 7 skip 3, 10 skip 4, and 12 skip 4, maybe) very carefully, using protractors to mark off the points at (almost) exactly equal distances along the circle  before connecting with straightedges. I will then show them a skeleton of the snap program so they can see the basic idea of how it works.I will have them try to decide, using their figures, how each of the blank spots in the program relates to their figures (formulas for various lengths and angles). I will have them actually DRAW 4 stars (5 skip 2, 7 skip 3, 10 skip 4, and 12 skip 4, maybe) very carefully, using protractors to mark off the points before connecting with straightedges, and then actually measure the angles before we look for patterns and formulas.

Alternatively, I may construct a geogebra exercise to let them explore the angles and distances in the stars. But I like the idea of making them draw them, as of right now. Or even try to have them figure out how to construct the stars in geogebra themselves (though I’m not sure how to do this MYSELF right this instant without using algebraic formulas and trig: requires more thought).

I think this frame has the possibility of working at many levels. It could be a one-day activity (figuring out the 5-star or even the odd-star) or up to weeks, depending on how far we go and how much I scaffold.  I’m not sure, at this point, how far I want to take it with the students. but I’m excited to keep working on it.

If you want to look at my Snap! program for star-making, and see what happens if you make your own stars of various sizes, you can click this link. The code for the starmaker itself is hidden inside a custom function block called Starmaker, but you can access it by right-clicking on the block and choosing “edit.” If you find a different or better way of doing it, please let me know! I have an idea for using a list of points (calculated using traditional circle trig defs) and then connecting the points in the same way a human would, but that’s less accessible for geometry students and less scaffoldable. Though it might make it doable in Desmos or geogebra or processing, where this activity would be thought of as line segments between algebraic points rather than a path walked by a turtle with a pen.

I leave you with this final picture of a 200-pointed star (skipping 97, very close to the smallest possible point angles in this size star). (A totally unrelated discussion could arise about where those funny patterns at the left, right, top, and bottom come from, since in theory it should have perfect rotational symmetry at each of the points, not just at the four cardinal ones. This, I think, comes down to pixels – being squares they don’t actually produce perfect diagonal lines, and the patterns are a resulting optical illusion. Neat!)