Made with ❤️ by Alvaro Israel 👏🏻 Get in Touch!
This challenge consists of implementing the behavior similar to the 'paint bucket tool' of MS-Paint. The program should hold an array of symbols and characters representing the shape of an image. With each array value representing a pixel in that image. Each pixel should have a color and, identical characters or symbols would represent the same color. For example: The following 4x6 matrix represents the image of the letter 'P', collored by '#', having the background color of '.'.
.###..
.#..#.
.###..
.#....
The program should recieve one pixel (from that image), a new color, and then be able to paint the correct adjacent region filled with that same pixel's color, exactly like the 'paint bucket tool' of MS-Paint does.
Examples:
Pixel (0, 1) and new color 'o':
# Previously:
.###..
.#..#.
.###..
.#....
# Afterwards:
.ooo..
.o..#.
.ooo..
.o....
Pixel (1,3) and new color 'o':
# Previously:
.###.
.#..#.
.###.
.#....
# Afterwards:
.###..
.#oo#.
.###..
.#....
Pixel (1,3) and new color '#':
# Previously:
.###..
.#..#.
.###..
.#....
# Afterwards:
.###..
.####.
.###..
.#....
To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/AlvaroIsrael/paint-bucket-simulator.git
# Go into the main app folder
$ cd paint-bucket-simulator
# Install dependencies
$ yarn install
# Run the app
$ yarn start
# Open up terminal and run
$ yarn test
Code coverage html report can be found at:
./paint-bucket-simulator/coverage/lcov-report/index.html
This software is under GNU General Public License v3.0. See LICENSE for more details.