this contains awful hacks, the structure of
print_next_colour(), and
display()
Really needs to be reworked because they share a lot of state about the
pattern (whether it is forwards or backwards, horizontally and
vertically), but don't explicitly pass any of it between them. I
literally only need to give print_next_colour() two variables (x and y) for it
to get the correct colour, without needing to share super ugly state.
A better option might just be to generate the rainbow in 2x length and
store forwards+reverse. That would save a lot of runtime arithmetic.