CSC1016S Assignment 6: Graphical User Interfaces

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (7 votes)

1. Assignment Instructions
This assignment involves constructing a Java program that supports interaction via a graphical user
interface.
2. The Task
The object is to implement a graphical game. The basis for the game is quite simple. Presented with
a 6×6 grid of Scrabble tiles, the challenge is for the player(s) to form as many high scoring words as
possible.
 Words may only be formed from sequences of adjacent tiles.
 Two tiles are adjacent if their edges or corners meet.
 A tile may be used in at most one word.
The highlighted letters spell the words ‘care’, ‘sway’, ‘sum’, ‘vole’, ‘rug’, ‘grebe’, ‘mile’.
The remaining letters can be used to spell the words ‘out’, ‘I’, ‘an’, ‘a’ and ‘a’, leaving the letter
‘u’ unused.
Beyond these simple rules, there are no limits to the form of the game.
 It could be played by one or more people.
 There could be a time limit.
 There are a variety of ways in which scores can be calculated.
 When a tile is used, ‘consumed’ even, it could be replaced with a fresh tile.
CONTINUED
It is up to you to decide the exact form of game that you wish to implement.
 The baseline is a single player game where the player simply seeks to get a good score.
Implement this and you potentially gain 80% of the marks.
 A further 20% of the marks are available for you to exercise your creativity; for developing a
bigger and more engaging solution.
Just consult the marking criteria (section 4) and make sure you meet them.
3. Resources
We have a number of components that you might like to use. You will find them on the Vula
assignment page, along with documentation.
3.1 Object Types
We have constructed a Tile class, a TileCollection class, and a TileGUI class.
 A Tile object represents a Scrabble tile.
 A TileCollection represents a bag of Scrabble tiles.
 A TileGUI object may be used to provide a graphical representation of a Tile.
We’ve used the ‘Model-View-Controller’ pattern in our component design i.e. a Tile is a thing, and a
TileGUI is a graphical representation of that thing.
The TileGUI is a sub class of JButton. This means it is ‘clickable’ and an ActionListener can be
attached to it.
3.2 Lexicon
The game requires a lexicon of words with which to check a player’s selection. We have provided a
text file called ‘EnglishWords.txt’. (You may remember it from the CSC1015F assignment on file I/O.)
We have also provided a utility class called ‘FileToArray’ that may be used to (as the name suggests)
read the contents of the word file into an array.
The class contains a static class method called “read’. You use it as per the following example:
String[] words = FileToArray.read(“EnglishWords.txt”);
Note that the method may throw an exception if something goes wrong. Specifically, it may throw
an ‘IOException’ or ‘FileNotFoundException’ exception. Your code will need to incorporate some
exception handling.
Notes on exception handling in Java are available from the assignment page. Alternatively, consult
the text book!
CONTINUED
4. Marking Criteria
4.1 Documentation [5 marks]
 Description of game.
 Instructions on how to run.
4.2 Correctness [45 marks]
 Creates a grid of tiles.
 Tiles may be selected by clicking.
 When a tile is selected, its appearance must change to indicate selection.
 A tile can only be selected if:
o It has not already been used.
o It is the first tile in a new sequence OR it is the n+1th tile in the current sequence
AND is adjacent the nth tile.
(A tile is adjacent to another if their edges or corners meet.)
 A tile can be deselected if it is the last tile in the current sequence.
 If a player attempts an illegal selection then the selection is ignored and an alert generated.
 A player is able to indicate when selection of a tile sequence is complete.
 The program uses a dictionary to determine that a sequence forms a legal word.
 If a sequence forms a legal word then its score is calculated and used to update the player’s
total score.
 If a sequence does not form a legal word it is rejected and must be deselected.
 The game ends when the player(s) cannot form words with the unused tiles.
4.3 Design and Implementation [30 marks]
 Use of suitable data types (defining new classes of object where appropriate).
 Use of methods to structure code (i.e. to create sub routines that help break down complex
problems).
 Encapsulation and Information hiding.
 Literate programming: meaningful variable, method, and class names.
 Use of comments.
4.4 Creativity [20 marks]
 Significant additional functionality above the baseline of a game where the player seeks to
beat a personal best.
END