Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions