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 than one number, e.g. the middle spot is in all the odd numbers, hence the…

# Tag Archive for modulo

# 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 this program is the iteration of z2+c where c is a point in the complex…

# 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 divisible by both 3 & 5 with “FizzBuzz”. Apparently many people have difficulty with it.…