Alan Richmond

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 order. The most-used orders are numerical, and alphabetical. It’s extremely useful in many applications, because sorted data can …

Animated Tower of Hanoi

The Tower of Hanoi is a classic problem that lends itself well to a recursive solution. The story involves some poor monks having to move 64 disks of different sizes (with central holes for the pegs) from one peg to …

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 to do, though it may be worth noting that the spots display is oh-so-slightly clever. Some spots appear in more …

A Python Dictionary

This is simply a dictionary of Python keywords, implemented as – of course – a Python dictionary! Dictionaries are key:value pairs. The value can be any object, such as a tuple of strings. The first item in the …

Editors & IDEs

A text editor is all very well for simple notes, but for programming the basic text editor will quickly become very tedious. For example, Python uses code indentation to indicate ‘blocks’, using tabs or spaces (4 spaces recommended for each …

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 computer games. As is well-known, sound can be digitised and stored in computers. Conversely, numbers can be converted …

Compute Average Heights

This is a simple program to compute average heights. In a loop, it prompts the user for heights, inputs a text string and converts it to a ‘real’ number, sums them, and divides by the number of heights. Exit is …

Binary Search

Binary Search is one of the most fundamental computer algorithms. Given an ordered list of some data (names, numbers, …) find out if it contains a particular item. For example, consider the list: 2, 4, 5, 7, 8, 11, 12. …

Naive Mandelbrot Set

This is your basic Mandelbrot Set plotter. Very little effort made to speed it up, except for plotting top & bottom pixels together as they’re mirrored across the x-axis. Later I’ll show you some much faster programs!

The heart of …

FizzBuzz

This is apparently a well-known interview question (but not one I was ever asked). Print the numbers 1 to 100, but replace every number divisible by 3 with “Fizz”, every number divisible by 5 with “Buzz”, and every number that’s …

How the Web works, in Amazing Detail!

Astonished kitten

Visiting a web site seems so simple – click on a link in your web browser, and soon – within seconds we hope – an interesting web page reveals itself to us. What could be easier?

In fact, what happens …

WordPress Tips & Tutorials

WordPress

This WordPress Tips & Tutorials article offers a few tips gained from a few years of experience with building and tuning WordPress websites. It also links to further articles for optimising WordPress, and some tutorials.

WordPress started in 2003 as …