Bag Of Cows

Pseudo Code Library

Imperial Flag of Leachonia

Mr Leach has had enough of all this teaching nonsense, and has decided to realise his full potential by becoming head of state of a new transglobal empire, which will be called 'Leachonia' in his honour.

Because of your expertise in Run Length Encoding, you have been selected to program the display of the new Imperial flag.

There is some python code to get you started here, and this is what you are required to produce.

These are your instructions, minion, and you'd better do a good job because you know our Leader doesn't handle disappointment well.....

Main task

Copy the example code and adapt it to produce the design of the flag.

You will need to find the Hex values of some suitable colours.

First extension

Often when a colour logo is photocopied in black and white, it doesn't look at all good.

For that reason, most organisations will have two versions of their logo, one that looks good in colour and another which works well in shades of grey.

Adapt your code for the flag so that it asks you whether you want colour or greyscale, and then produces a suitable image. You should be able to do this with only half a dozen or so new lines of code.

Harder extension

At the moment the design of the image is hard coded into the python file. It would be better if the data for the image could be stored in a separate file which the program was able to read in and use.

Step 1: Design a cunning file format which will allow you to store the information about the image in a text file which the program can read and use.

Step 2: Adapt the program to read the file and produce the image.

Step 3: Make a new file containing a different image, and have the program allow you to select which file to use.






* Does Mr Leach have just one purple tie? Or a set of identical ties? And if so, how many in the set?

These questions will likely form the basis for religious schism and endless bloody wars in the future . . . you could make yourself famous by writing a Great Work on the subject now....