Checkpoint 21.10.1.
Build the flood fill algorithm. Tip: we need to test the βout of boundsβ test case BEFORE we try to check if the current location is already filled in.
floodFill on the four neighboring cells (up, down, left, right).
as the first line inside floodFill`. You will get to see evidence of all of the function calls, even those that are a base case and do not do anything.
curRow or curCol are less than 0 because they are of type size_t. A size_t can not be negative. If it is 0, and you subtract 1 from it, it will wrap around to the largest possible number it can represent. (Similar to the large value string::npos represents.)
curRow >= rows will catch both βThe row number got too bigβ and βwe went below 0β. If there are 10 rows and we go to row 11, that is out of bounds. If we are at row 0 and try to subtract 1, we will end up with a value like 18446744073709551615. That will also count as out of bounds.
main so the start row is 0 and the start col is 4. That location is not surrounded by walls.