# Introduction

This week we looked at what happens to water molecules when they are heated up.

We started with a little science experiment to demonstrate Brownian Motion, this was done with a glass of very hot water and a glass of very cold water and some ink.

When the ink is dropped in the two glasses it behaves very differently, in the cold water the ink stays suspended and visible as ink for a long time, but in the hot water the ink gets mixed into the water molecules very quickly, this is because the water molecules in the hot water are moving around much faster and bashing into the ink molecules and mixing them up.

Can you guess which glass has the cold water in?

## The Plan

The plan was to build a scratch program that would  show the water molecules moving around faster or slower, depending on temperature. In order to do this we needed the following:

• A Sprite for our water molecule
• A slider to control the temperature
• Some code to make them move around.

## The Sprite

Water molecules are made up of 2 Hydrogen atoms and 1 Oxygen atom (H2O), the Oxygen atom is quite large compared to the Hydrogen atoms and the Hydrogen atoms stick to the Oxygen atom at about a 45 degree angle, they end up looking like Mickey Mouse, so our Sprite looked something like this:

We changed the settings of the Clone so it didn’t rotate.

## The Temperature Slider

In order top control the temperature we created a variable, making sure that it was set for “All Sprites” and that it was set to be a slider. We also set the minimum and maximum values:

## The Code

As we needed lots of these Sprites we decided to use the Create Clone block (Control) to create 100 of them.

In order to move the Sprites around we needed to keep looping, picking a random direction and then moving a little bit. We also needed to change the amount we moved and also the direction as the temperature went up. The direction needed to be more upwards as the temperature got higher so the water molecules would start floating like steam if the temperature got high enough.

We used a Gravity variable to make sure the Sprites pointed upwards as the temperature got higher, because this needed to be different for all the Sprites so they moved in random directions, we created the Gravity variable “For this Sprite only”

The code ended up looking like this:

Initialise the Temperature variable and then create 100 clones.

Initialise the Sprites Gravity variable

Pick a random spot along the bottom of the Stage

Make sure we are pointing more towards the top, depending on the temperature.

If the temperature is > -1 move around, otherwise we are frozen, so just go back to the bottom of the screen.

# Notes:

The project that we built is available on the Scratch Web Site: