Posted in Harmonograph Intermediate

Spectral Harmonographs

This Python + Pygame program draws the trace of 4 decaying sine waves, 2 per axis, with rainbow colours. It… read more Spectral Harmonographs

Harmonograph in Pygame
Posted in Harmonograph

Harmonograph in Pygame

You may have seen those devices at the Science Museum or Exploratorium or Techniquest… There’s a drawing surface and some… read more Harmonograph in Pygame

Posted in Basic Numbers

Number guessing game

The number guessing game incorporates several simple but important elements of elementary programming and is a good candidate for an… read more Number guessing game

Posted in Basic

Popular Sorting Algorithms

Sorting is probably the most common type of algorithm in programming. A sorting algorithm puts elements of a list in a certain… read more Popular Sorting Algorithms

Posted in Basic

Stars and Stripes

A variation on the Stars and Stripes American Flag for Independence Day. It’s an exercise in the use of transparency in… read more Stars and Stripes

Posted in Intermediate

Animated Tower of Hanoi

The Tower of Hanoi is a classic problem that lends itself well to a recursive solution. The story involves some… read more Animated Tower of Hanoi

Posted in Beginner

Rainbow Flag in Pygame

This little Pygame program paints the Rainbow Flag, as used by the LGBT movement. It illustrates: Importing the Pygame library… read more Rainbow Flag in Pygame

hello world
Posted in Beginner

A Quick Introduction to Python 3 Programming

This Quick Introduction to Python 3 aims to teach you just enough Python, so that you can get started in… read more A Quick Introduction to Python 3 Programming

Hilbert curve
Posted in Fractals Intermediate Turtle

Drawing Fractals with Lindenmayer Systems

Lindenmayer systems, or L-systems, provide a very powerful way to construct fractals. Lindenmayer used L-systems to describe the behaviour of… read more Drawing Fractals with Lindenmayer Systems

Posted in Beginner Turtle

A Fake Circle made of Straight Lines

Inspired by this post on Reddit, I wrote this little script to do the same thing. The circle is an… read more A Fake Circle made of Straight Lines

Posted in Beginner Fractals Turtle

Tweetable Python Code Golf

Code Golf is the amusement of writing as short as possible a program to perform a given task. So for… read more Tweetable Python Code Golf

Posted in Basic Numbers

Playing in Python with Pickover’s Premise per Pi

My favourite tweeter is Clifford A. Pickover. His tweets are delightful nuggets of math, physics & more. I have a copy… read more Playing in Python with Pickover’s Premise per Pi

Posted in Beginner Games

A Graphical Dice Simulator

This PyGame program simulates the roll of a die (or dice if you prefer). It’s a fairly simple, straightforward thing… read more A Graphical Dice Simulator

Posted in Advanced Fractals

Fast Mandelbrot Set by QuadTree

Most Mandelbrot Set programs proceed along the display area, pixel by pixel horizontally, row by row from top to bottom…. read more Fast Mandelbrot Set by QuadTree

Posted in Basic Text

A Python Dictionary

This is simply a dictionary of Python keywords, implemented as – of course – a Python dictionary! Dictionaries are key:value… read more A Python Dictionary

Harmonograph
Posted in Harmonograph Intermediate

Extensible Harmonograph

Often seen in science museums, the harmonograph is a device that combines wave motions (e.g. from some pendulums) to move… read more Extensible Harmonograph

Posted in Beginner

Editors & IDEs

A text editor is all very well for simple notes, but for programming the basic text editor will quickly become… read more Editors & IDEs

Posted in Audio Intermediate

Make ‘Computer Music’ with a very small program!

This is a fun little program to generate ‘computer music’, specifically ‘bytebeats’ which sound like the chip music featured in the early… read more Make ‘Computer Music’ with a very small program!

Posted in Basic Pyplot

Easy Graph Plotting with Pyplot

Graphs (also known as charts) are an indispensible visual aid for conveying a lot of data in an easy-to-digest form…. read more Easy Graph Plotting with Pyplot

Posted in Beginner Numbers

Compute Average Heights

This is a simple program to compute average heights. In a loop, it prompts the user for heights, inputs a text… read more Compute Average Heights

Posted in Basic Numbers

Binary Search

Binary Search is one of the most fundamental computer algorithms. Given an ordered list of some data (names, numbers, …)… read more Binary Search

Posted in Basic Turtle

Random Walk

A colourful random walk. The basic idea is very simple: choose a random heading in the range 0:360 degrees. Step… read more Random Walk

Posted in Beginner Turtle

Turtle Star

A very simple Turtle program. Turtle can draw intricate shapes using programs that repeat simple moves. Turtle graphics is a… read more Turtle Star

Posted in Basic Turtle

Sierpinski Triangle, drawn by a Turtle

This is a classic fractal drawn with a recursion algorithm and Turtle graphics. The Sierpinski Triangle’s sides are bisected and… read more Sierpinski Triangle, drawn by a Turtle