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
when green flag clicked
go to x: (50) y: (0)

move (50) steps

turn cw (120) degrees

move (50) steps

turn ccw (60) degrees

turn cw (60) degrees

move (50) steps
clear

set pen size to (3)

set pen color to (0)

pen down

change pen color by (50)

pen up
repeat (6)
end

repeat (6)
end
Recommended blocks for solution 2
when green flag clicked
go to x: (50) y: (0)

point in direction (0 v)

move (50) steps

turn ccw (60) degrees

turn ccw ((360) / (3)) degrees

move (50) steps
clear

set pen size to (3)

change pen color by (30)

pen up

pen down
repeat (6)
end

repeat (3)
end
define triangle

triangle :: custom
Recommended blocks for solution 3
when green flag clicked
go to x: (0) y: (0)

move (150) steps

turn cw (120) degrees

move (150) steps

turn ccw (120) degrees

point in direction (90 v)

go to x: (75) y: (-45)

turn ccw (120) degrees
clear

set pen size to (3)

set pen color to (0)

pen down

pen up

change pen color by (50)

pen down

pen up
repeat (3)
end

repeat (3)
end
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