This is a somewhat longer exercise than the rest. It's also a little more complex.
Personally, I'm going to do it in Python, and strongly encourage you to do so.
In this exercise we're going to manipulate images.
PixelTime
If it's your first time manipulating images, don't panic. It's a lot easier than it looks like.
As a start, we're going to deal with the simplest images. Binary images
What are binary images?
They're the simplest kind. Each pixel is represented by 0 or 1. Here's an example:
0000000000
0011000100
0011100100
0011011100
0001011110
Every pixel represented by 1 is in the foreground, 0 are in the background. Your task is to determine how many separate objects are in the foreground.
What is an object?
When 2 pixels connect, they are part of the same object. Two pixels connect when they're on the next position vertically or horizontally. Diagonales do not count.
ABC
DEF
GHJ
E connects with DBHF.
As a quick hint, the first image had 2 objects.
You are free to do what you want for a user interface (command line, GUI, from file, ...). Have fun coding. Since code might be bigger, I would suggest you used your favorite pastebin for readability reasons.
IMPORTANT NOTE: The other exercises are still open. As a matter of fact, I will finish working on the LebInt exercise before moving to this one.
Personally, I'm going to do it in Python, and strongly encourage you to do so.
In this exercise we're going to manipulate images.
PixelTime
If it's your first time manipulating images, don't panic. It's a lot easier than it looks like.
As a start, we're going to deal with the simplest images. Binary images
What are binary images?
They're the simplest kind. Each pixel is represented by 0 or 1. Here's an example:
0000000000
0011000100
0011100100
0011011100
0001011110
Every pixel represented by 1 is in the foreground, 0 are in the background. Your task is to determine how many separate objects are in the foreground.
What is an object?
When 2 pixels connect, they are part of the same object. Two pixels connect when they're on the next position vertically or horizontally. Diagonales do not count.
ABC
DEF
GHJ
E connects with DBHF.
As a quick hint, the first image had 2 objects.
You are free to do what you want for a user interface (command line, GUI, from file, ...). Have fun coding. Since code might be bigger, I would suggest you used your favorite pastebin for readability reasons.
IMPORTANT NOTE: The other exercises are still open. As a matter of fact, I will finish working on the LebInt exercise before moving to this one.