Please read the entire document before asking any questions or commencing the assignment.
- The work is to be assessed on two deliverables with the following relative weighting:
- 80 % System analysis and design report
- 20 % Software prototype developed in Java 8 Standard Edition within NetBeans 8.
You are required to design an object-oriented software version of the two-player card game called Garbo. This is an original game by David Parlett1 which uses a subset of a traditional 52 card pack. A detailed description of the game can be found at the following web page:
To aid comprehension of the game, an appendix is attached to this specification which describes the pertinent features of the game (derived from the above web page).
The target development language is Java 8, Standard Edition operating in the NetBeans 8 IDE within a Microsoft Windows environment.
To keep this assignment relatively simple, the game should be designed to work for two players sitting side- by-side at a PC (or laptop) with a single keyboard, who take turns using the same keyboard or mouse. In other words, a two-player non-networked version of the game.
Please note that the majority of the assessment is weighted to the software process in terms of requirements, analysis and design and the delivery of a design report. We are not expecting everyone to achieve perfect, working software and the assessment weighting has been apportioned accordingly.
It is anticipated that, realistically, your software artefact may only be a prototype with a basic console (text- based) user interface, although those students who wish to do more are encouraged to explore graphical user interfaces in Java. Ideally, this will be a working prototype, but even if you do not manage this then you should aim to provide at least some completed Java classes that map to the core classes of your object- oriented design that is presented in the report. With regards to the mark allocation, a GUI is not compulsory and full marks can be attained for the implementation component if you produce a full working prototype that has a text-based (console) interface.
Note, this is an exercise in ‘forward engineering’, not ‘reverse engineering’. Designs and implementations will be scrutinised carefully by the module team. That is to say, the system implementation must follow the system design rather than coding a system and then retrospectively producing design diagrams afterwards.
Any design reports that reflect a reverse engineered approach will be regarded as simply code documentation, not a design report, and for this you should expect significant mark penalties.
1 Author of the ‘Penguin book of card games’, published by Penguin books.
The system design report must be presented as a PDF document, and should follow the structure specified below. All chapters should begin on a new page. All sections and pages should be numbered appropriately. All diagrams and/or illustrations should have an appropriate caption, which is also numbered.
Note that a nominal proportion of the marks will be for presentation of the report i.e., untidy, poorly structured documents will be penalised.
Contents page including list of figures and/or tables Chapter 1: Requirements
A full domain/product description, domain workflow illustration(s) using UML activity diagrams, all
functional requirements, all quality requirements deemed appropriate, a comprehensive list of use case descriptions which convey a main success scenario. Note: use case diagrams are not required and will gain no marks if included. All use cases should be represented as text-based, descriptive use cases which indicate a step-numbered main success scenario, with inclusions and/or extensions as appropriate.
Chapter 2: Initial conceptual model
A full class diagram with a complete set of labelled associations, compositions and generalisation where appropriate. All associations should indicate correct multiplicities. Initial class descriptions (in terms of class attributes) should be included, and any invariants on the model described appropriately. The initial conceptual model should not include any class operations.
Chapter 3: Dynamic designs
An appropriate series of use case driven designs conveyed as dynamic UML models (i.e., sequence diagrams), operation specifications, and possibly some UML object diagrams. The objective of this chapter is to show how use-case driven dynamic design has led to a significantly more detailed implementation model than the initial conceptual model and include more detailed class descriptions (including class responsibilities in terms of operations, or methods) with a commentary on how the class descriptions have evolved during dynamic design.
Chapter 4: User interface interaction
A commentary on user-system interaction flow using UML state machine diagram(s). It is suggested that you design user interface mock-ups using basic drawing tools, and use these mock-ups as a context for the human-system interaction that is modelled using UML state machine diagrams.
Chapter 5: Testing
A presentation of how the design and implementation was verified with respect to the functional requirements, and how the system was validated with respect to the use cases.
If you achieve a software prototype, then it must be presented as a single NetBeans 8 Java project.
To reiterate what was explicitly stated above, the prototype must demonstrate a clear mapping to the detailed implementation model that is presented at the end of Chapter 3 of the system design report.
The two artefacts (report and NetBeans project) should be combined into a single ZIP (or 7zip) file for submission. A link for uploading the work will be available in the Unihub course page, week 24 folder.
Appendix: Garbo (Two player card game)
The game is played with a 32-card subset of a traditional 52-card packs, and comprises the Ace, King, Queen, Jack, Ten, Nine, Eight and Seven of each of the four suits (Spades, Hearts, Clubs, Diamonds).
Each suit, and rank, has a point value as follows:
From the (shuffled) 32-card pack, deal four cards to each player and stack the remaining cards face down.
The ultimate aim is for a player to achieve the highest score using the scoring rules described below. The game play itself is based on a grid layout. The objective at each player turn is to place cards in a 4 x 4 grid in such a way as to avoid duplicating the suit of an adjacent card and the rank of a card in the same row or column. Any such match of suit or rank gives away points to the opponent.
Each player in turn, starting with the non-dealer, plays a card face up to the table. Each subsequent card must be placed side by side with a card already on the table. The first sixteen cards played must eventually form a square of four rows and four columns. Leave enough space between the vertical edges of adjacent cards to allow a card to be turned sideways without overlapping (which will happen later).
The game comprises two ‘levels’ using 16 cards for each level. Figure 1 below illustrates a mid-game position for the first level
- If you play a card that matches the suit of any adjacent card, either diagonally or orthogonally, your opponent can claim the value of the matching suit.
- If you play a card that matches the rank of any card in the same row, column or diagonal, your opponent can claim the value of the matching rank.
- If you make more than one such match, your opponent can score them all.
For example, refer to Figure 1 above. Playing the ‘ten of hearts’ immediately below the ‘seven of spades’ gives no scoring points away as it neither matches the suit of any adjacent card nor the rank of any of the cards in the same row or column.
However, if the ‘ten of hearts’ is played immediately below the ‘eight of clubs’ then this will give 24 points away, calculated as follows. Because it matches the suit of two adjacent cards i.e., the ‘jack of hearts’ and the ‘ace of hearts’, and the suit value of hearts is two, this gives away four points. In addition, this placement will also give away 10 points for any card of the same rank in the same row, column or diagonal (because the ‘ten of hearts’ is rank ten). In this scenario, the ‘ten of spades’ is in the same row, and the ‘ten of clubs’ is diagonal. Therefore, this gives away 20 points for the same-ranked cards, and the total points given away would be 24.
Note that it is the responsibility of the opponent to ‘claim’ the score prior to their move.
Remember that the initial deal is just four cards to each player which is, of course, only enough cards to complete half of the 4 x 4 grid for the first level. When each player has placed his/her four cards, another eight cards are dealt to each player (from the face down stack). This means that each player can select four from eight in hand to complete the first level, leaving four cards in hand to commence the second level.
When the first level is complete (i.e., a full grid of 16 cards all facing up on the table), the remaining cards are dealt so that each player will have eight cards in hand. The score for the first level should be calculated, and the player currently with the higher score goes first in the second level. If the scores are equal, the person who played last in level one goes first in level two.
During the second level, at each turn the player places a card on top of a face-up card that was previously placed during level one. But before placing the card (for level 2), the face-up card (from level one) must be turned over and rotated 90 degrees to show that it cannot be played on again. This is illustrated by Figure 2 below.
Figure 2: Level two grid example
Figure 2 shows that level two has commenced with the placement of the five of spades and the six of hearts.
Scoring continues as before, but with an additional penalty. If a player places a card on top of a (level one) card that matches on either rank or suit then the opponent scores ten times that particular value, in addition to the normal scores for matching cards that are adjacent (by suit), or in line (by rank).
For example, referring to Figure 2 above, suppose a player were to place the seven of hearts ‘over’ the seven of spades (remember, for level two, the cards still need to be placed side by side with a card previously placed during level two, so in this case that would be the five of spades). In this case, the opponent would score ten times the value of the rank (seven), i.e., 70 points. However, in addition, this would make the seven of hearts adjacent to the ten of hearts and jack of hearts, which would give another four points away (2 points for each adjacent card matching on suit). So the opponent could claim a total of 74 points.
Obviously, in terms of game strategy, there are times when a player has limited choice on where to place a card, and no choice when the game reaches the placement of the final card.
The game is over after the completion of the two levels, and the winner is the player with the highest score.
Garbo Card Game
Garbo is a two player card game in which a subset of a deck of cards ( 52 cards ) is taken and are played with. In this game you each play cards to a layout in such a way as to avoid matching suit or rank with cards already placed in the same row or column.
The game is played with a 32-card subset of a traditional 52-card packs, and comprises the Ace, King, Queen,
Jack, Ten, Nine, Eight and Seven of each of the four suits (Spades, Hearts, Clubs, Diamonds).
Each suit, and rank, has a point value as follows:
Rules of the game are:
If you play a card that matches the suit of any adjacent card, whether diagonally or orthogonally, your opponent can claim the value of the matching suit.
If you play a card that matches the rank of any card in the same row, column or diagonal, your opponent can claim the value of the matching rank.
If you make more than one such match, your opponent can score them all.
This is a computer based game prototype in which both the players will use the same mouse and keyboard.
It has a text user interface which shows the current cards left with each player and asks the player whose turn is due to enter the position of the card from the available cards he wants to for his next turn. Then he is asked to enter the row and column where he wants to place the card.
The points of each player after the turn is displayed on the screen and then the program asks the other player to take his turn.
Initial Conceptual Model
The two classes are used for the program. First class is Cards as depicted in figure2.1 . The Cards class contains two arrays , one for storing the suits and the other one for storing the rank of the cards. The cardSuit and CardRank will be used as the indexes of the arrays. Suit() function is used to display the suit index of the suit array and suitStr is the suit. Similarly, rank() is used to display the rank index of the rank array and rankStr is the rank.
Procedure class is the main class of the game . It contains all the variables and functions needed to run the game. Score1 and score2 variables represent the respective scores of player 1 and player 2. The main functions of the procedure class are allocateCards() , turns() and levelRules(). LevelRules() contains all the rules of the game.
The relationship between Cards class and procedure class is one-many relationship.
The sequence diagram for the whole game is shown in figure 3.1 . In this sequence diagram the player is first dealt with a subset of cards and then he is asked to have his turn . The program first checks the user input. If the user input is valid then the game is resumed else the game restarts. The card placed by players are placed on the 4X4 grid.
Then the program checks for the rules and the rules are alloted. Then the turn of next player continues till the end of the game.
The program sees that whether the rules are followed or not and hence the winner is decided.
User Interface Interactions
The game starts with a 4X4 empty grid. The 4 cards are allocated to each player and the scores are initialized to zero. The program then asks the user to enter the position of the card he wants to play from his available cards . Then the program asks the player1 to enter the row and column number where he wants to place the card.
The card format is first symbol represents the card Rank and the second symbol represents the card suit.
Example : 7c means a 7 of clubs.
Now the program does the same procedure for the second player.
First half of level One Over
After each player gets 4 turns , 8 more cards from the remaining deck are given to each player as shown in figure 4.2
The game continues for next 4 turns for each player till the grid is full. This is the end for level 1 of the game . Last four cards are dealt to each player for the level 2 of the game. After the cards are dealt each player has eight cards each . The scores after game 1 are calculated and the person who has higher score after round 1 starts first as given in .
On the commencement of level2 , the (X) sign is attached with the card suit which shows that no furthur card can be dealt on top of it. Level 2 rules are applied and the player attains higher score after level 2 wins and the result is displayed as shown in figure 4.4
As shown in the figure 4.4 , the winner of the game is player 1 with score 217.
Testing for rule 1 : If you play a card that matches the suit of any adjacent card, whether diagonally or orthogonally, your opponent can claim the value of the matching suit.
As in figure 5.1 the player 2 placed a card diagonally with player 1’s card of same suit. The program sees that the cards are of same suits and the rank of the card ie three year is allotted to player 1.
Testing of rule 2: If you play a card that matches the rank of any card in the same row, column or diagonal, your opponent can claim the value of the matching rank.
As in figure 5.2 the player 2 placed a card diagonally with player 1’s card of same rank. The program sees that the cards are of same ranks and the rank of the card ie eleven year is allotted to player 1.
Testing rule 3 : If you make more than one such match, your opponent can score them all.
As shown in figure 5.3 player 2 placed a card Qs . The player 1 got 13 points as it satifies both rule 1 ( 1 point) and rule2 (12 points) hence 13 points are allotted to player 1.
Looking for Computer Science Assignment Help. Whatsapp us at +16469488918 or chat with our chat representative showing on lower right corner or order from here. You can also take help from our Live Assignment helper for any exam or live assignment related assistance.