In this project, you will be designing and implementing a game in which a 4x4 grid of letters is randomly chosen, and then the players try to identify as many words in that grid as possible. Words can be formed by any sequence of adjacent letters in the grid. For example, consider the following grid.
c k s z
x o t h
d g r n
z n a m
The word "sock" is formed starting at the letter "s" in the top row, moving down diagonally to the "o", moving up diagonally to the "c", and finally moving right to the "k". Note that letters can be connected horizontally, vertically, and diagonally. The same occurrence letter may not be used more than once in the same word, however. Thus, "tot" is not a valid word in the above grid. In the real game, a player earns points for each word found in the grid, with an n-letter word earning n points. For example, "so" is worth 2 points while "strand" is worth 6 points. An invalid guess (i.e. a word not in the dictionary or not on the board) costs the player 1 point.
A dictionary file named dictionary.txt has been provided for you. Design and implement a GUI-based program for playing this game. At a minimum, your program should generate and display the board, allow the user to repeatedly enter words, display the valid entered words, show the player the words at the end, and allow them to play again. For example, a very basic interface might look like the following: See image.
For extra credit, you may add additional functionality to the game (e.g., scorekeeping, a time limit).
You have the freedom to select the data structures and algorithms that you consider to be more efficient for this task. Of course, you will have to justify your decisions.
As data structures, you may consider using hashtables, trees, AVL trees, binary search trees. Any other data structures are admissible as well – although, again, you have to be able to justify your selection.