Skip to content

πŸͺ£ A simple typescript program to solve the flood fill algorithm!

License

Notifications You must be signed in to change notification settings

AlvaroIsrael/paint-bucket-simulator

Repository files navigation

Paint Bucket Simulator

Paint Bucket Simulator Logo

A simple typescript program to solve the flood fill algorithm!

Challenge β€’ Technologies Used β€’ How To Use β€’ How To Test β€’ License

Made with ❀️ by Alvaro Israel πŸ‘πŸ» Get in Touch!

πŸ’‘ Challenge

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:
.###..
.####.
.###..
.#....

πŸ† Technologies Used

πŸ’» How to Use

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

🎯 How to Test

# Open up terminal and run
$ yarn test

Code coverage html report can be found at:

./paint-bucket-simulator/coverage/lcov-report/index.html

🧾 License

This software is under GNU General Public License v3.0. See LICENSE for more details.

About

πŸͺ£ A simple typescript program to solve the flood fill algorithm!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages