Skip to content

Homework 3

In this final TP you are requested finalize your Skyjo implementation. Specifically, you are asked to do the following:

  1. Finalize your model and controller implementation, if not already done.
  2. Apply the command pattern, to generate Command objects, reflecting valid game choices at every decision point. In addition to the previously implemented commands (Pop card from stack, Reject Card, Reveal undisclosed card) you will have to implement:
    • Pickup card from discard pile (into buffer)
    • Replace undisclosed/disclosed player card with buffer
    • Option to eliminate a column with 3 available cards.
  3. Advance your commands to support undo operations (the UI interets u as an undo request). Note that undo is not allowed if the previous command revealed new information, e.g. disclosed a card.
  4. Ensure the game is fully playable until the game end. (Not required to implement multiple game sessions, round indicates the round counter within one session.)
  5. Rigorously respect the MVC pattern, there must be absolutely no logic (e.g. Model factory) in the Model component.
  6. Support for dynamic choice of game size (support passing various ModelPreset) to Controller:
    controller.initializeModel(ModelPreset.XYZ, players);, XYZ being the desired preset.

Your implementation must accurately reflect the game rules. Taking shortcuts, e.g. revealing a random card instead of allowing for user choices, or deviating from the expected command sequences leads to severe point reduction.

Code is a grade preliminary

Your grade is based on your ability to explain and reason with your submitted code, during the subsequent oral exam. Functional code is a preliminary for taking the oral exam: While missing features in your code will result in a grade reduction, no points by themselves granted for the submitted implementation.

Illustrations

In this sections you find a few illustrations of the expected behaviour, for certain situations.

Availability of undo

An undo is available, whenever the previously executed command did not reveal undisclosed information. It is offered on console by a u option.

Round:            1
Deck (80):     [??]
Discard ( 1):  [ 4]
Cache:         [--]

Max  (18)        Ryan  (15)       Maram  (3)       QUENTIN  (18)    
[??] [??] [12]   [??] [??] [ 6]   [??] [ 1] [??]   [ 7] [??] [??]   
[??] [ 6] [??]   [??] [??] [ 9]   [ 2] [??] [??]   [??] [11] [??]   

 0: Take discarded card.   1: Take deck card.   

Enter choice: 
0

The player selected 0, which placed a previously disclosed card from the discard card pile into the buffer. Execution of this command did not reveal new information. It can be undone.

Round:            1
Deck (80):     [??]
Discard ( 0):  [--]
Cache:         [ 4]

Max  (18)        Ryan  (15)       Maram  (3)       QUENTIN  (18)    
[??] [??] [12]   [??] [??] [ 6]   [??] [ 1] [??]   [ 7] [??] [??]   
[??] [ 6] [??]   [??] [??] [ 9]   [ 2] [??] [??]   [??] [11] [??]   

 u: Undo               0: Replace (0/0)      1: Replace (1/0)      2: Replace (2/0)     
 3: Replace (0/1)      4: Replace (1/1)      5: Replace (2/1)     

Enter choice: 
u

As you can see, the follow-up actions did include u: undo, because the previous command can be undone. Undoing the command reverts the model back to the previous state, i.e. the buffer card is placed back on top of the discard card pile, so the player can adjust their action:

Round:            1
Deck (80):     [??]
Discard ( 1):  [ 4]
Cache:         [--]

Max  (18)        Ryan  (15)       Maram  (3)       QUENTIN  (18)    
[??] [??] [12]   [??] [??] [ 6]   [??] [ 1] [??]   [ 7] [??] [??]   
[??] [ 6] [??]   [??] [??] [ 9]   [ 2] [??] [??]   [??] [11] [??]   

 0: Take discarded card.   1: Take deck card.   

Use a command history.

Cascaded undos may occur and must be supported, it is not sufficient to only store a single undo. You already have the right data-structure to store a chronologic history of previously executed commands: a stack.

Unavailability of undo

Undo is prohibited, whenever the previous executed command revealed new information to the players.

Illustration: When taking a card from the deck, new information is revealed to the player (value of topmost deck card, which now is stored in buffer). It is not allowed to undo the corresponding Reveal command, the user has to proceed to either accepting and placing, or rejecting the buffer card.

Round:            1
Deck (80):     [??]
Discard ( 1):  [12]
Cache:         [--]

Max  (6)         RYAN  (18)       Maram  (15)      Quentin  (14)    
[??] [ 6] [ 0]   [??] [??] [ 9]   [??] [??] [11]   [??] [??] [??]   
[??] [??] [??]   [??] [??] [ 9]   [ 4] [??] [??]   [??] [ 7] [ 7]   

 0: Take discarded card.   1: Take deck card.   

Enter choice: 
1

The player selected command 1, which placed a previously undisclosed card from the fresh card pile into the buffer. Execution of this command revealed new information. It cannot be undone.

Round:            1
Deck (79):     [??]
Discard ( 1):  [12]
Cache:         [ 6]

Max  (6)         RYAN  (18)       Maram  (15)      Quentin  (14)    
[??] [ 6] [ 0]   [??] [??] [ 9]   [??] [??] [11]   [??] [??] [??]   
[??] [??] [??]   [??] [??] [ 9]   [ 4] [??] [??]   [??] [ 7] [ 7]   

 0: Reject card        1: Replace (0/0)      2: Replace (1/0)      3: Replace (2/0)     
 4: Replace (0/1)      5: Replace (1/1)      6: Replace (2/1)     

Enter choice: 

As you can see, the follow-up actions did not include u: undo, because the previous command cannot be undone.

Interfaces

You will be working with the same interfaces as previously provided. No modifications to your pom.xml are required or allowed (except for optional plugins for code documentation, testing, packaging, for the brave).

Interface documentation remains available online.

Contribution statement

Include a PDF file with the following information and statement:

Information

Per team member:

  • The percentage of work they contributed.
  • 2 classes / methods they declare themselves designated experts for.

Statement

Include this statement in your submission, sign it on paper, take a photo and add it to your submission.

We hereby declare that we have not used generative AI to produce any content for this TP submission, and have not copied code from other sources without giving credit in the program comments. We understand that including AI generated content, or copying foreign code without due credit is a serious academic offense and will be reported to the university plagiarism commission, which may lead to our expulsion from the study program.

  • Signature: ____
  • Signature: ____
  • Signature: ____

  • Date: ____

Submission

Submission is due by Friday 05-12-2025 Saturday 06-12-2025, 11:59PM per email to schiedermeier.maximilian@uqam.ca.

  • Subject TP3
  • Content:
    • Single zip file with: Maven project
      • pom.xml
      • src folder
    • Contribution statement, signed.

Do not submit your target folder.

Point reductions

While your grade is based upon your ability to explain your code, you can loose points (i.e. the maximal grade you can obtain is lowered) if certain requests are ignored by your solution:

Implementation reductions

  • No maven: -100%, avoid at all costs.
  • Commands not fully implemented: -100%, avoid at all costs.
  • No contribution statement: -100%, avoid at all costs.
  • Provided interfaces modified and/or not used.
  • Code does not compile with mvn clean compile, version 24: -100%, avoid at all costs.
  • Code crashes upon execution with mvn exec:java, version 24: -100%, avoid at all costs.
  • Game cannot be played / no player interaction: -100%, avoid at all costs.
  • Additional non-jdk dependencies added / third party libraries used (except provided interfaces): -100%, avoid at all costs.
  • Commands incorporate randomness / implicit behaviour to substitute player choices: -30%
  • Incorrect state machine, i.e. command sequence inconsistent to game rules: -30%
  • Undo not implemented, incomplete or incorrect: -30%
  • Logic still in model: -20%
  • Overly complicated implementation: -5% per method with more than 25 lines (comments not counting)

Submission reductions

  • Late submission: -30% starting at the deadline, another -20% for each additional 24h delay.
  • Submission contains junk/hidden files or binary files (.class files): -5% per unnecessary file.

MISC

Questions

  • For questions related to the TP requirements, please use the Mattermost forum.
  • Do not share code or parts of your solution on Mattermost.

Suggestions

While not a strict requirement, and not directly leading to bonus points, it is always a good idea to brighten up the professor's mood with a few tricks:

  • Double-check your submission before sending it to the prof:
    • Send it first to a team member. Let them extract the ZIP, compile the code etc on a different machine.
    • If all works well, forward the email to the prof.
  • Format your code: Use IntelliJ code format combo, so your code is easier to read.
  • Revisit the labs: Parts of the solutions for this TP have been subtly covered in the labs. If you think a lab solution qualifies for reuse, place a comment in your code.
  • Comment your code: Use javadoc /** ... */ for methods, and regular comments // in-line.

Get used to english comments and naming conventions

You have the right to comment in French, and the language you use for comments is guaranteed to have absolutely no impact on your grade. However, keep in mind that computer science is an international discipline and on the long term you'll most likely have to comment in english anyway. Better get used to it early. Same for variables and method names: Get used to english names, it makes things a lot easier on the long run. I once worked in an international team where every intern added comments and naming in their native language, so we have English, German, French, Spanish, even Chinese. With no surprise this had a detrimental effect on the project.