MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / main

Function main

contents/flood_fill/code/c/flood_fill.c:201–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201int main() {
202 int grid[25] = {
203 0, 0, 0, 0, 0,
204 0, 0, 0, 0, 0,
205 1, 1, 1, 1, 1,
206 0, 0, 0, 0, 0,
207 0, 0, 0, 0, 0
208 };
209 int grid1[25] = {
210 0, 0, 0, 0, 0,
211 0, 0, 0, 0, 0,
212 1, 1, 1, 1, 1,
213 0, 0, 0, 0, 0,
214 0, 0, 0, 0, 0
215 };
216 int grid2[25] = {
217 0, 0, 0, 0, 0,
218 0, 0, 0, 0, 0,
219 1, 1, 1, 1, 1,
220 0, 0, 0, 0, 0,
221 0, 0, 0, 0, 0
222 };
223 int answer_grid[25] = {
224 1, 1, 1, 1, 1,
225 1, 1, 1, 1, 1,
226 1, 1, 1, 1, 1,
227 0, 0, 0, 0, 0,
228 0, 0, 0, 0, 0
229 };
230
231 struct canvas c = {5, 5, grid};
232 struct canvas c1 = {5, 5, grid1};
233 struct canvas c2 = {5, 5, grid2};
234
235 struct point start_loc = {0, 0};
236
237 int pass_cnt = 0;
238
239 recursive_fill(c, start_loc, 0, 1);
240 pass_cnt += grid_cmp(grid, answer_grid, 25);
241
242 stack_fill(c1, start_loc, 0, 1);
243 pass_cnt += grid_cmp(grid1, answer_grid, 25);
244
245 queue_fill(c2, start_loc, 0, 1);
246 pass_cnt += grid_cmp(grid2, answer_grid, 25);
247
248 printf("Test Summary: | Pass\tTotal\n");
249 printf("Fill Methods |\t%d\t3\n", pass_cnt);
250
251 return 0;
252}
253

Callers

nothing calls this directly

Calls 4

grid_cmpFunction · 0.85
recursive_fillFunction · 0.70
stack_fillFunction · 0.70
queue_fillFunction · 0.70

Tested by

no test coverage detected