Question: The Source code in Java please Write a grid-fill program. Suppose you have a grid that contains randomly placed 0s and 1s as shown below.
Write a grid-fill program. Suppose you have a grid that contains randomly placed 0s and 1s as shown below. You should write a program that allows you to select a random cell that contains a 0 and flip that cell and all other adjacent cluster of cells that have 0 to 1, or, select a random cell that contains 1 and flip that cell and all adjacent cluster of cells that contain 1 to 0. To select the adjacent cell, consider neighbors in the left, right, top, and down directions only. You need not consider neighboring cells along the diagonals. For example, in the above grid, if you select the highlighted cell that contains a 0, your program should flip that cell and all other adjacent cell that contains 0 to 1, as shown below. The modified cells are shown in bold
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
