CS2851 -- Lab 4: Wordsearch

Outcomes Addressed

  • understand and apply complex data structures and algorithms.
  • use appropriate algorithms (and associated data structures) to solve complex problems.
  • understand the use of recursion in problem solving.
  • be able to use data structures in software design and implementation.
  • be able to apply standard library data structures in software design.

Overview

In this lab, you will write a program to find all the words in a dictionary that can be spelled by combining adjacent letters in a grid of letters.

Procedure

You are required to design, implement, and test a program that will will read in a file consisting of a grid of letters and write a file containing all possible combinations of adjacent letters that spell words in a dictionary. Words with fewer than three characters should not be considered. Two example files are cs2851L4a.txt and cs2851L4b.txt. Your program should store all of the words from the dictionary in a JFC container that implements the Set interface.

In addition, your program should produce an output file that contains all of the words found in grid of letters. Although it is not required, you may wish to create a graphical user interface for your program. You may even wish to create an interface to simulate a popular board game and generate your own random grids.

The green text in the following grid demonstrates legal letter combinations for LOOT, APE, and ROPE, but the letters that formed ROPE may not be used to form PORE since R and E are not adjacent to one another.

ULEA
AOAP
FROP
HVKT

ULEA
AOAP
FROP
HVKT

Interim Deliverables (due 11:00pm, Friday of week 6)

Given the following grid of letters:

cel
khp
cow

Use your recursive algorithm to produce a list of all the legal combinations of letters beginning with the center (h). For example, your list should include the following (not necessarily in this order):

hce
hcel
hcelp
hcelpw
hcelpwo
hcelpwoc
hcelpwock
help

Create a .zip file containing all of your source code files required to produce the results described above and a file called words.txt containing the complete list of words generated by your recursive algorithm, as described above. Submit the words.txt as the report and the .zip file as the support file.

Note: This submission will be worth 30% of your grade for this assignment. I do not plan to grade the source code unless I have questions about how the list was generated. Your grade will be based on generating the correct list of words.

In addition, you should indicate how much time you spend on this assignment in the FAST system. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent during the first week (logged for week 6) before the due date given above.

Lab report (due 11:00pm, Friday of week 7)

Here is a template file to use as a starting point for this report.

Your report should include:

  • A completed UML class diagram (as a .gif or .png image) containing all classes and attributes (fields and methods) used in your solution to this assignment.
  • A discussion of how you approached the problem. This should contain a sufficient level of detail to convince your instructor that you were thinking as you worked on this assignment.
  • Sample program output (using cs2851L4a.txt as input).
  • A brief description of any problems you encountered or questions you have regarding the lab.
  • A discussion of how you worked together as a team.
  • The Documented source code for your program.
  • Be sure to log the time you spend on this project in the FAST system (logged for week 7).

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult your instructor.

Acknowledgment

This assignment was originally developed by Dr. Chris Taylor.

  • © 2001-2009 Dr. Christopher C. Taylor •
  • Office: L-343 •
  • Phone: 277-7339 •
  • npǝ˙ǝosɯ@ɹolʎɐʇ