Given an m by n grid of letters, and a list of words, find the location in the grid where the word can be found. A word matches a straight, contiguous line of letters in the grid. The match could either be done horizontally (left or right) or vertically (up or down). We will not consider words that can be matched diagonally.
The input will be in a file called hidden.txt and your output will be written to a file called found.txt. The format of the input file will be as follows:
There will be k lines in your output file. Each line will have the word that you were search for followed by two integers i and j separated by one or more spaces. The numbers will be right justified and aligned. The number i gives the row and the number j the column of the first letter of the word that you were required to find. Rows and columns are numbered conventionally, i.e. the first row is 1 and the first column is 1. If you do not find a word in the grid then the values for i and j will be 0 and 0. Use the full power of the built-in functions associated with strings and lists.
Extra Credit (10 points): Find all the diagonal words. The diagonal words could go either right to left or left to right along any diagonal. Give the row number and the column number of the first letter of the word.
For this assignment you may work with a partner. Both of you must read the paper on Pair Programming. .
The file that you will be turning in will be called WordSearch.py. The file will have a header of the following form:
# File: WordSearch.py # Description: # Student Name: # Student UT EID: # Partner Name: # Partner UT EID: # Course Name: CS 303E # Unique Number: # Date Created: # Date Last Modified:
If you are working with a partner both of you will be submitting identical programs but make sure that you have your partner's name and eid in your program. If you are working alone, then remove the two lines that has the partner's name and eid in the header.
Use the turnin program to submit your WordSearch.py file. The proctors should receive your work by 11 PM on Friday, 15 Nov 2013. We will be looking for clean logic and good documentation. There will be substantial penalties if you do not adhere to the guidelines.