Always at 23.59 on the same day as your TA session (Except if another deadline has been agreed with the TA). Consult the deadline for your class on the delivery plan.
The learning goals of this week is frameworks aspects: analyzing your current HotStone system as a framework, as well as adding a graphical user interface for HotStone using the MiniDraw framework.
The handed out code below is missing the class below, which contains a function to compute the 'atIndex' parameter to the 'playCard(..., atIndex)' call in your PlayCardTool.
Find DropZone
in DropZone.java and put it into
package hotstone.view.tool
.
You can use it like the following example shows in your PlayCardTool:
@Override public void mouseUp(MouseEvent e, int x, int y) { // Note: no check if draggedActor is null, as it is guaranteed // Invoke related facade method, if figure is a card boolean isHittingField = y < GfxConstants.Y_LIMIT_OF_FIELD; boolean moveCardBack = true; if (isHittingField) { Card associatedCard = draggedActor.getAssociatedCard(); int index = DropZone.computeFieldIndexOfDropPosition(editor.drawing(), draggedActor.displayBox().getX(), draggedActor.displayBox().getY()); ....
Alternatively, just always drop the card at index 0.
Spend the first 15-20 minutes of the class in plenum discussing...
TDD and One Step Test tells us to to keep focus, take small steps and pick a next test (target of attention) from our list of tests/requirements which is doable and will teach us something.
When developing the From Domain to GUI coupling between your HotStone domain code (Game) and the MiniDraw GUI's visual representation of all game elements (HotStoneDrawing and its associated Figure instances) we have the problem that Game mutator method calls can not be made from the GUI, as we have not developed the MiniDraw tools yet.
This is a classic "mutual dependency" issue, and the solution is to "break that dependency". In the exercise below it is solved by introducing a kind of Fake Object: the TriggerUpdateTool (FRS §37.7.3) which acts a a surrogate/replacement of the real soon-to-be-developed tools.
Ensure you have completely solved the Observer pattern exercise from Iteration 7. If not, you will never get the GUI running!
Carefully read FRS 37.7 "Frameworks" as it details the design you are required to implement, and the support code. You must carefully merge your own code with the provided code base 'hotstone-framework-start (ZIP)' code, the link is given below. See the hints below.
My slides from Week 9 on "HotStone GUI" provides further details and hints on the exercises.
Analyse whether your HotStone production code is a framework, using the framework characteristics.
Download the hotstone-framework-start (ZIP) and merge it carefully into your HotStone project using the process I outline below in the Hints section. If you just extract the zip in your HotStone folder, you will overwrite some of your existing code!
This exercise is partially solved in the handed-out code base.
Complete the implementation of the provided but incomplete
HotStoneDrawing
class such that all state changes in a Game are observed and reflected in proper GUI updates.
Visual test class: ShowUpdate
(package:
hotstone.domain2gui), gradle target:
update
. Be sure to read the details in FRS
37.7.3!
It is advisable to integrate directly with a simple, real HotStone variant (for example AlphaStone) compared to using a Test Double/FakeObject. See the explanation in FRS 37.7.3.
This exercise is partially solved in the handed-out code base.
Complete the implementation of the MiniDraw Tools such that all graphical interactions are translated into the correct game mutator calls.
Visual test class: ShowTools
(package:
hotstone.gui2domain), gradle target:
tools
. Be sure to read the details in FRS
37.7.4!
Develop a complete GUI based SemiStone for system testing: Combine your developed SemiStone variant from the previous mandatory sprints with the solutions to this iteration's exercises.
Main class: HotSeatStone
, gradle target:
hotseatstone
. Executing this target should start a
full HotStone game in hotseat mode, allowing you to play with
a group member. Congratulations :).
Deliveries:
You have developed a lot of code, and now comes a new ZIP with even more code which poses the challenge of overwriting stuff. Be sure to make an 'integration' branch of your code and merge/extract the Zip file there, so you can "Do Over" in case it messes up.
I advice to unzip the supplied framework starter code in a distinct folder, and test that you can run the visual targes, like ShowText etc., correctly.
The process is that you can simply unzip or copy the contents of the Zip file onto your own code base (ensure that folders align up). This WILL overwrite some of your implementation files (probably 'StandardHotStoneGame.java' and 'TestAlphaStone.java'), so keep a backup ready or selectively merge from your main branch.
Next compile and test, and fix all issues until all is fixed. Run also the visual tests, like 'gradle update', etc.
When all your own test cases work; and the newly added programs run (ShowTools, etc.); then merge back into your main branch and push to the repository.
Your submission is evaluated against the learning goals and adherence to the submission guidelines. The grading is explained in Grading Guidelines. The TAs will use the Iteration 8 Grade sheet to evaluate your submission.
Learning Goal | Assessment parameters |
Submission | Git repository contains merge request associated with "iteration8". Git repository is not public! Required artifacts (document, screencast) must all be present. |
Framework Analysis and Usage | The framework analysis of HotStone is correct, uses the proper terminology (hotspots, frozen spots, inversion of control, etc.), and discusses Template Method (separation and unification variant discussed). MiniDraw's hotspots are used correctly to produce the GUI for HotStone. |
MiniDraw Domain to GUI Integration |
The HotStoneDrawing implementation correctly
updates the GUI for all HotStone Game state changes
(demonstrated by the 'gradle update' target.)
|
MiniDraw GUI to Domain Integration | The 'gradle tools' target correctly allows handling all the of the developed tools (PlayCardTool, MinionAttackTool, etc.), and all the tools are correctly working and implemented. |
System Test | The system test ('hotseatstone' target) correctly executes a SemiStone game with full MiniDraw GUI integration. |