Using code to test an optical illusion

We finished Term 3’s coding classes with a coding challenge to test the effectiveness of an optical illusion.

While they may not look it, the horizontal lines in this image are straight and parallel. To prove it, the classes took the code that produces the image and tweaked the settings to change the offset, size and colour of the squares, all of which help to determine the effectiveness of the illusion.

You can see from the ‘chequerboard’ below that simply separating the squares proves the shape of the lines. Likewise, changing the colour of the squares  – in this case to ‘cyan’  – reduces the illusion, due to there being less colour contrast than for the black.



Code Champions September 2024

Enjoying JavaScript in Term 3

Our older classes have been tackling JavaScript this term.

It’s a challenging programming language but offers some fun and engaging outcomes, plus the chance to start adding more interactivity to the HTML and CSS code from last term.

The couple of weeks we’ve been working with variables. This gave us the opportunity to create and run a ‘dog age calculator’ and code that calculates how much food we’ll eat in a lifetime.

Next up loops!

How much you will eat in your lifetime: apples, grains of rice, metres of noodles, and chocolate bars!

Code Champions September 2024