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

Function main

contents/flood_fill/code/cpp/flood_fill.cpp:125–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125int main() {
126
127 const std::vector<std::vector<float>> grid{
128 {0, 0, 1, 0, 0},
129 {0, 0, 1, 0, 0},
130 {0, 0, 1, 0, 0},
131 {0, 0, 1, 0, 0},
132 {0, 0, 1, 0, 0}};
133
134 const std::vector<std::vector<float>> solution_grid{
135 {1, 1, 1, 0, 0},
136 {1, 1, 1, 0, 0},
137 {1, 1, 1, 0, 0},
138 {1, 1, 1, 0, 0},
139 {1, 1, 1, 0, 0}};
140
141 const CartesianIndex start_loc{1, 1};
142
143 auto test_grid = grid;
144 recursive_fill(test_grid, start_loc, 0.0, 1.0);
145 assert(test_grid == solution_grid);
146
147 test_grid = grid;
148 queue_fill(test_grid, start_loc, 0.0, 1.0);
149 assert(test_grid == solution_grid);
150
151 test_grid = grid;
152 stack_fill(test_grid, start_loc, 0.0, 1.0);
153 assert(test_grid == solution_grid);
154
155 return EXIT_SUCCESS;
156}

Callers

nothing calls this directly

Calls 3

recursive_fillFunction · 0.70
queue_fillFunction · 0.70
stack_fillFunction · 0.70

Tested by

no test coverage detected