This App returns the total number of islands that appear on the screen. Islands are surrounded by water and are formed when all pieces of land (marked with a “🏝”) in a group are connected to each other by at least one adjacent side. You can safely assume that if it’s not a “🏝”, then it’s water. Valid adjacent sides are top, left, bottom, and right.
Two pieces of land sharing the same corner but no adjacent side are considered not connected to each other.
- The grid is 10 x 6 (10 rows and 6 columns).
- When tapping on a cell, the corresponding cell should show a piece of land.
- The piece of land should disappear if the cell is tapped again.
- Update the label’s island count after each tap.
- When tapping the reset button, all islands should be removed, and the counter reset to 0