CPS 6, Ramm - Spring 2000 - 4/3/00, #29
- Announce
- Group work today
- If you missed Saturday's lecture, read up
on operator overloading and the enum statement
Recursion, Lists, and Matrices
- Combine Use of Matrices and Recursion
- Graphical Problem
- Printer Plot as Start
- The Blob Count Problem
- Count the number of blobs on the screen
- imagine counting "things" seen under microscope
- Shapes may be weird
- Need to decide what constitutes "connected"
- Group work: Outline Blob Count Program
- You must be part of a team
- Team must contain 3 or 4 people
- Before that: See what we can learn from
- Graphics Fill Problem
- Example: Recursive Solution to Fill Problem
- (Should give you hint as to how to approach blob count)
- Use character plot
- 0 represents space
- 1 represents figure boundary
- larger numbers represent colors
-
fillplot.cpp
- Recursive Specifics of Fill
- Routine does nothing (no recursive call) if:
- Hit boundaries of graph
- Hit boundaries of figure
- Hit point already colored
- Color current point [r][c]
- Call Fill (recursively) for:
- Each of eight neighboring points
-
[r-1][c-1] [r-1][ c ] [r-1][c+1]
-
[ r ][c-1] - - - - - -[ r ][c+1]
-
[r+1][c-1] [r+1][ c ] [r+1][c+1]