Question: Using Python In this problem, you will implement a program that solves the Word Search puzzle, which is to search if a word appears in
Using Python
In this problem, you will implement a program that solves the Word Search puzzle, which is to search if a word appears in a two-dimensional
table/list of n rows and n columns of upper-case characters. The word can either appear in a row from left to right, in a column from top to bottom, or in a diagonal from top to bottom (either top-right to bottom-left, or top-left to bottom-right). The word may not fill out the entire row/column/diagonal. To break-up your problem into smaller tasks, do the following.
(a) Write a Boolean function CheckRow (table, r, pos, word) that checks whether the string word appears in row r of the two dimensional list, table, starting at position pos.
(b) Write a Boolean function CheckColumn (table, c, pos, word) that checks whether the string word appears in column c of table starting at position pos.
(c) Write a Boolean function CheckDiagonal-TRBL(table, pos, word) that checks whether the string word appears in table starting at position pos and running diagonally from top-right to bottom-left.
(d) Write a Boolean function CheckDiagonal-TLBR(table, pos, word) that checks whether the string word appears in table starting at position pos and running diagonally from top-left to bottom-right.
Using the above functions, write a program that reads a square table of characters from a text file (the file extension should be .txt), and a word from the user, and returns whether or not the word appears in the table, and in case it appears, the position of each character in the table.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
