Task 3 Ideas

This task if done with some thought can be the basis of the other tasks still to do.  

It could usefully be split up into some smaller tasks. 

1) Entering a number to show how many lines to enter

2) Check the number of lines that have been entered is more than two

3) Enter the data one line at a time

4) collect together the entered data 

5) Process the data - this could be further split to process a line and process a character

Some Links to resources

Splitting a String using a loop

Splitting a String using Regular Expression  (using a List)

String Handling       

Decompressing the Data

The data comes as a number followed by a character - so something like 05e would produce a run of five e characters  "eeeee"   One way of doing that is in the video below. 

So if you have managed to split the string into threes then you can use this idea in the video to process the characters onto a string.  The code in the video is in the file below.

When you are making this program you probably need to think about having lines of strings that are the same length and start a new line when you want to.  using the \n switch - see the line of code below - the "\n" will add make a new line. 

Automating the process

You can add onto a string to create one single string to then print out. 

The code above processes each line of RLE entered code and makes a single string with all of the lines in - then prints that string.  

I decided to use some separate code to process each line so that it could be reused for some of the other tasks.  The \n switch makes a new line in the string. 

The code below was my approach to processing a single line of RLE code and returning it to make up a whole picture. 

Another way of processing a character below.  

The text for this and some testing code is below