Draw a star

Challenge Level: Growing experience

Learning outcomes

Students will be able to:

Requirement:

Write a program that draws a 6-pointed star (hexagram).

A 6 pointed star.

Testing examples:

There are no testing examples for this challenge.

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks for solution 1
whenclicked
gotox:50y:0move50stepsturn120degreesmove50stepsturn60degreesturn60degreesmove50steps
clearsetpensizeto3setpencolorto0pendownchangepencolorby50penup
repeat6repeat6
Recommended blocks for solution 2
whenclicked
gotox:50y:0pointindirection0move50stepsturn60degreesturn360/3degreesmove50steps
clearsetpensizeto3changepencolorby30penuppendown
repeat6repeat3
definetriangletriangle
Recommended blocks for solution 3
whenclicked
gotox:0y:0move150stepsturn120degreesmove150stepsturn120degreespointindirection90gotox:75y:-45turn120degrees
clearsetpensizeto3setpencolorto0pendownpenupchangepencolorby50pendownpenup
repeat3repeat3
Hints

There will be a few ways to do this. Below are hints for three different ways you can program this.

  • Solution 1: By drawing a hexagon inside a star (see challenge 7.2).

    A hexagon inside a star.
  • Solution 2: By drawing 6 triangles;

    1. draw a triangle,
    2. move back to the last vertex drawn,
    3. turn 60 degrees (as if you are drawing a hexagon)
    4. repeat steps 1-3 6 times).
    6 triangles.
  • Solution 3: By drawing 2 triangles.

    2 triangles.

Show Scratch solution