A word search puzzle consists of letters arranged in a grid, some of which form words. The player solves the puzzle by finding all these (hidden) words which can be displayed in any direction. An example of a wordsearch is shown below.
Figure: see image.
For this ACW the student must write a C# console application that implements a word search. The steps that follow form a specification of how the program should function and its features. Where the specification is vague the student can make assumptions, however, the program should not have any features additional to what is described in this specification. All assumption should be clarified with a member of the module staff.
B should be presented with a menu with options to either use a default puzzle file, load the current saved wordsearch or select from a list of files.
Figure: see image.
If the user selects the first option from the initial menu they should be presented with a default wordsearch that is the same as is found in "File01.wrd" but is hard coded into the application. This will ensure students are still able to make progress if they struggle to load wordsearch puzzles from files.
Figure: see image.
If a user selects the second option the program should display all files in the current directory with the file extension ".wrd".
Figure: see image.
Note - this means that your program should look in the current directory to see what file are in the current directory, and ask the user to pick from them.
The following code can be used to return an array of strings with the appropriate file paths:
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.wrd");
The solution that you have been provided with includes seven wordsearch files. Be aware that some are provided as test files that your program should reject for various reasons - being in the wrong format for example. The program should be able to load any file that is in the correct format. If the program attempts to load a file in the incorrect format it should display an error message and give the user the option to load another file or use the default file. Details of the file format can be found later in this document in the section on "Puzzle File Specification".
Some example test files have been provided for you. You may wish to add additional test cases to your solution. Details of the provided test files are in the table below.
Filename | Comments |
File01.wrd | contains only horizontal words |
File02.wrd | contains only horizontal and vertical words |
File03.wrd | contains horizontal, vertical and diagonal words |
File04.wrd | Incorrect number of words |
File05.wrd | Incorrect File Format |
File06.wrd | Words outside of grid |
File07.wrd | Incorrect overlapping words |
As a file is parsed the word search data should be generated and stored in variables. The program should make use of appropriate data structures such as arrays and structs to store the word search
The word search puzzles are defined in a file that is loaded and parsed by the program. The file uses a comma-separate variable (CSV) format.
The first line of the file specifies:
6,5,3
apple,0,0,right
pear,1,0,down
orange,0,3,right
Figure: see image.
When displaying the puzzle board all the words that have been found should be coloured Green
If the user's makes an incorrect selection it should be coloured Red. Only the previous incorrect selection is highlighted i.e. the red highlighting does not accumulate as the user makes more incorrect selections
Figure: see image.