CMSC 201

Project 2 - Due 5/12

This homework must be submitted by 11:59pm on the due date to get any credit.

Autofill

For this project, we will be implementing a tool called "autofill". Some of you may be familiar with this tool from programs such as paint. You will be given a text file full of Xs and Os, looking like this:

OOOOOOXOOOO
OOOOOXOOOOO
OOOOXOOOOOO
XXOOXOOOOOO
XXXXOOOOOOO
OOOOOOOOOOO

The grid may be any size, but will always consist only of Xs and Os.

Autofill takes a given square, and if it is an X does nothing. If the square has an O in it, it changes the O to an X and autofills the square above, below, to the left, and to the right. An example run of the program:

Please enter a filename: input.txt
OOOOOOXOOOO
OOOOOXOOOOO
OOOOXOOOOOO
XXOOXOOOOOO
XXXXOOOOOOO
OOOOOOOOOOO
Please enter a square to fill, or q to exit: 1, 1
XXXXXXXOOOO
XXXXXXOOOOO
XXXXXOOOOOO
XXXXXOOOOOO
XXXXOOOOOOO
OOOOOOOOOOO
Please enter a square to fill, or q to exit: 6, 1
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
Please enter a square to fill, or q to exit: 4, 3
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
Please enter a square to fill, or q to exit: q

Invalid inputs are permitted to crash your program. Your autofill function should be recursive. Indexing starts at 1.

Submitting

When you've finished your homework, use the submit command to submit the file. You must be logged into your account and you must be in the same directory as the file you're trying to submit. At the Linux prompt, type

submit cs201 PROJ2 proj2.py

After entering the submit command shown above, you should get a confirmation that submit worked correctly:

Submitting proj2.py...OK

If not, check your spelling and that you have included each of the required parts and try again.

You can check your submission by entering:

submitls cs201 PROJ2

You should see the name of the file that you just submitted, in this case proj2.py