Bucket
Difficulty: Easy
In this exercise, you will build a simplified Bucket Fill tool commonly found in drawing applications. The app displays a grid, where each cell contains a random number. When a user taps on a cell, the app should identify all directly connected neighboring cells that share the same number and fill the entire connected region with a specific color based on that number. The fill should automatically spread through all matching neighboring cells until no more adjacent cells share the same number.
Requirements
- Display a 10x8 grid of cells. Assign each cell a random number from 1 to 3.
- Each number corresponds to a specific color: 1 = Red, 2 = Green, 3 = Blue.
- When a user taps on a cell: Identify the number of the tapped cell. Fill that cell and all directly connected neighbors (up, down, left, right) with the same number. Continue filling recursively through all matching neighbors until the entire connected region is complete. Apply the appropriate color to each filled cell.