Word search PDF

Title Word search
Author Frank L
Course Fundamentals of Computer Science
Institution California Polytechnic State University San Luis Obispo
Pages 4
File Size 100 KB
File Type PDF
Total Downloads 81
Total Views 154

Summary

Word search puzzle project...


Description

Project 4 – Word Search CPE 101

Purpose The primary goal of this project is to practice working with strings. In addition, this program provides an opportunity for you to test your understanding of all of the different concepts (conditional logic, loops, lists, and functions) you have learned in the quarter until now. Programming environment. This is an individual programming project. You are responsible for all the work related to the program development, testing, and submission.

Testing You will need various input and output files to test your program. Sample files are available on our Canvas page. Unlike other projects, I do not provide you will an instructor executable. But I do provide you with sample output files that your program should match for the given input files. The input files are named puzzle0, puzzle1, and puzzle2. The corresponding output files are output0, output1, and output2.

Program Description In this project, you will implement a program which locates words in common word search puzzles (all puzzles are 10x10). A sample puzzle is shown below: WAQHGTTWZE CBNSZQQELS APXWKWIIML LDELFXXSAV PONDTMVUXN OEDSDYQPOB LGQCKGMMIT YCSLOACAZM XVDMGSXCYZ UUIUNIXFNU The above puzzle contains the words (shown in red bold): UNIX, CALPOLY, CPE, GCC, SLO, and CAMPUS. Words can appear in the puzzle running up, down, forward, backward, or diagonal (down/right only). You do not need to check other diagonal directions (up/right, up/left, down/left).

Input and Output Input: Your program will begin by reading in the puzzle and words to search for. You will not prompt the user for the input, simply assume they will type it. You may assume all input will be valid input. •

Puzzle - Your program should read in a 100 character long string from user via standard keyboard input. o o



These strings are available (at the first line) in the input files called: puzzle0, puzzle1, puzzle2) Using this user input, you should create a 10x10 puzzle which you can work with, in order to find the words in the puzzle.

Words to Search For - Your program should also at the same time read in words from user via standard keyboard input. o o

These words are available (at the second line) in the input files called: puzzle0, puzzle1, puzzle2) These are the words that are to be found in the puzzle by your program.

For example, here are the contents of puzzle0. Your program should assume this format, 100 characters worth of puzzle on the first line, then all the words on the second line: WAQHGTTWEECBMIVQQELSAPXWKWIIILLDELFXPIPVPONDTMVAMNOEDSOYQGOBLGQCKGMMCTYCSLOACUZMXVDMGSXCYZUUIUNIXFNU UNIX CALPOLY GCC SLO CPE COMPILE VIM TEST

After reading the data in, your program should have data structures that look something like this (feel free to use whatever variable names that make sense to you): puzzle: ['WAQHGTTWEE', 'CBMIVQQELS', 'APXWKWIIIL', 'LDELFXPIPV', 'PONDTMVAMN', 'OEDSOYQGOB', 'LGQCKGMMCT', 'YCSLOACUZM', 'XVDMGSXCYZ', 'UUIUNIXFNU'] words: ['UNIX', 'CALPOLY', 'GCC', 'SLO', 'CPE', 'COMPILE', 'VIM', 'TEST']

Remember that your program should not prompt the user for input. Just assume the user will enter the puzzle and words. Your program should be run as below (using one of the given input files or one that you have made): python3 word_finder.py < puzzle0

Sample program output: This is what your output should look like with the input file puzzle0: Puzzle: WAQHGTTWEE CBMIVQQELS APXWKWIIIL LDELFXPIPV PONDTMVAMN OEDSOYQGOB LGQCKGMMCT YCSLOACUZM XVDMGSXCYZ UUIUNIXFNU UNIX: (FORWARD) row: 9 column: 3 CALPOLY: (DOWN) row: 1 column: 0 GCC: (DIAGONAL) row: 6 column: 5 SLO: (FORWARD) row: 7 column: 2 CPE: (DIAGONAL) row: 1 column: 0 COMPILE: (UP) row: 6 column: 8 VIM: (BACKWARD) row: 1 column: 4 TEST: word not found *Note that the output for each word must appear in the order the words are specified in the input.

General Notes You must have total of three files in your submission: • • •

funcs.py This file must include the actual functions definitions/implementation. funcs_tests.py This file must include unit test functions, which contain the assert statements testing the functions developed in funcs.py. word_finder.py This file must include the main function, which calls all the functions developed within funcs.py.

Note that we have not specified a design for your program for you. You must decide what functions you will need and then implement and test them. Your grade will suffer if you implement your entire solution in your main function.

Suggestions • • •

I use the existing Python string functions: find, split, join Remember that a function can return multiple values using a tuple. You can break up a string or list using slicing.

Grading Your program grade will be based on: • • • •

Thoroughness of your funcs_tests.py tests Adherence to the specification Number of test cases passed (with perfect diff matching) Code style/design

Submission Push your completed code to GitHub. Your submission should include the following files: funcs.py funcs_tests.py word_finder.py...


Similar Free PDFs