Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. void fill(int *v, char **map, int nr_of_lines, int i, int j, int *count) {
  2. // check if we landed on a correct spot, return otherwise
  3. if (i < 0 || j < 0 || i >= nr_of_lines || j >= v[i] * 4 || map[i][j] != 0)
  4. return;
  5. // mark the spot and go again in each direction
  6. map[i][j] = 0x01;
  7. (*count)++;
  8. fill(v, map, nr_of_lines, i + 1, j, count);
  9. fill(v, map, nr_of_lines, i, j + 1, count);
  10. fill(v, map, nr_of_lines, i - 1, j, count);
  11. fill(v, map, nr_of_lines, i, j - 1, count);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement