HW09: Color Fill due Mon 25 Mar 10:00

\begin{purpose}
This assignment requires the use of 2-dimensional arrays and gi...
...tunity to create code in accordance with a pre-defined structure.
\end{purpose}

Allowed and Disallowed Resources

In completing this assignment you MAY use/access the following resources:

You may NOT use/access:

Failure to abide by these guidelines will result in a zero for the assignment and the incident will be reported to the university provost as a violation of the university academic integrity policy. A second incident of academic dishonesty (whether from this course or another computer science course) will result in an F in the course.

The Program

In this assignment you will create a class called MyCanvas that will perform a “fill” operation on an ASCII canvas. The canvas will be represented as a two-dimensional array of chars and will be defined in a text file that contains on the first line the number of rows and number of columns in the canvas (separated by a space). The remainder of the file has characters filling the number of rows and columns specified.

Here is an example input file:

10 10
      1111
1 1      1
1   1 1 11
1  1 1  11
111    1 1
1  1 1   1
11111 1111
1    1   1
1111  11 1
1111111111

Your program will implement a color filling algorithm that given a starting position and a drawing color (i.e., a character) will fill in any open space with the specified drawing color. Of course to know what we mean by “open space” we have to name a border color. So, if we view `1' as our border color and we wanted to fill in the space at the top of the canvas we would use the following commands:

   MyCanvas canvas= new MyCanvas();

   canvas.load("image1.txt"); // loads image from file into canvas
   canvas.setBorder('1');     // specifies that 1 is the border character
   canvas.fill('*',0,0);      // starting at position (0,0) fill area with *'s
   canvas.show();             // display the canvas

When the canvas is displayed we would expect to see this:

******1111
1*1******1
1***1*1*11
1**1*1**11
111****1*1
1  1*1***1
11111 1111
1    1   1
1111  11 1
1111111111

Notice that the color fills up, down, right, and left, but not diagonally.

Grading

NOTE: Use the original Driver.java provided in the original lab day assignment to demonstrate your program.

The assignment will be graded according to the following criteria:

Correctness 16 pts
Documentation 2 pts
Conventions 2 pts
Version Control 2 pts
Total 22 pts

Your program should be completely working and should follow all of the programming conventions named in class and explained in http://josephus.hsutx.edu/classes/all/javaconventions/ (including the use of comments that conform to the JavaDoc guidelines).

The instructor will grade your work based on what you have pushed to the hosted homework repository you have shared. For all assignments the program is due before the beginning of class on the due date. Repositories that show a commit time after that time will be graded as late.