Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Word search is a word game that involves searching for words in a (random) grid of letters. This program simulates the game by searching for words in a grid. The program differs from the physical game...

1 answer below »
Word search is a word game that involves searching for words in a (random) grid of letters. This program simulates the game by searching for words in a grid. The program differs from the physical game in several ways: where N is provided by the user as input The physical game is usually played with a 4 The physical game uses a random grid. Your program will read the grid of letters from a file. The physical game is timed: players try to find as many words as they can before a timer runs out. Your program will not have this constraint. The pyhsical game includes words found on all diagonals. We will simplity the word search by eliminating all but one diagonal search. 4 grid. Your program will generalize this to any N N grid N 4 · Definitions Given a grid of letters G and a list of words L, a word in G is legal if it meets the following criteria: it is at least three letters long: it can be formed from letters in G that are adjacent along a row (two cases: going left-to-right or right-to-left), a column (two cases: going top-to-bottom or bottom-to-top), or a diagonal (one case: going upper-left to lower-right); and it can be found in the list of words L File Names Your program should be in a file named word-search.py Expected Behavior Write a program, in a file named word-search.py, to do the following .Read in, in this order, the name of a word-list file and a grid-of-letters file. Do not prompt the user, that is, do not supply an argument to input). Simply read in two file names and treat the first as the name of a word-ist file and the second as a grid-of-letters file . Read the word-list file into a list and the grid-of-letters file into a square grid. You may assume that these files are organized as follows: o the word-list file contains one word per line; o the grid-of-letters consists of N lines, each line consisting of N letters separated by whitespace. .Search this grid for legal words. Matches of words found in the grid against those in the list-of-words should be case-insensitive Collect the legal words found into a list and print them out as indicated under Output format below.
Answered 102 days After May 21, 2022

Solution

Aditi answered on Sep 01 2022
66 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here