School Coding Class – 002

One of the children in the group came up with a solution to what we were exploring.   The solution was very close to what I first came up with in My Original Blog.  Coincidentally, that night, I was reading a blog called ‘Applying the Linus Torvalds “Good Taste” Coding Requirement‘.  It made me go back and examine my solution and explore other options in Scratch.

My next solution got rid of all of the conditional ‘If Then’ statements and utilised lists, instead.  I wouldn’t expect any of the children to come up with this solution but it has certainly been an interesting exercise for me as I explore Scratch, as well!

I’ve shared the code here.

Scratch Code for Challenge 1

School Coding Class – 001

In the class, we are starting to learn some programming.  The language we are using is called Scratch.

Scratch is a free visual programming language. It is aimed at young people, mainly 8 years old and up, with a purpose of helping them learn programming.

Scratch is available online and it’s easy to create an account if you’d like to use it outside of school.  Just follow this link.

The first challenge we are working on is below!

Get Scratch to draw a shape in a random location on the screen:

The shape must have a random number of sides between three and eight

If the shape is a triangle, it should be RED
If the shape is a square it should be ORANGE
If the shape is a pentagon it should be YELLOW
If the shape is a hexagon it should be GREEN
If the shape is a heptagon it should be BLUE
If the shape is an octagon it should be PURPLE

Repeat the above forever.

The video, below, shows what we are hoping to achieve.

A solution for this challenge may look something like this:

Scratch Code for Challenge 1

While the code took me ten minutes to write, it will be a significant task for the children which gives some terrific real world challenges for them to explore.  We will build on ideas and concepts in small stages working up to a complete solution.

The ideas and concepts include:

  • Events
  • Angles
  • Positive and negative integers
  • Random numbers
  • Coordinates on an x and y axis
  • Variables
  • Conditional expressions
  • Iteration (Looping) – Count controlled and continuous

Of course, along the way, the children discover different things that interest them which they add to their code which adds to the fun 🙂

There’s a wonderful TED video, below, which talks about teaching kids to code with Scratch.