Skip to content

Homework 1

In this first homework you're requested to implement a rudimentary Skyjo model implementation.

  • Model refers to: "everything that is needed to represent state"
  • Think of the model as the ensemble of information captured if someone were to take a photo of a running skyjo session at any moment in time.

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.

Implementation

You are requested to implement the SkyjoModel interface, which implicitly also inherits all methods defined in the SkyjoModelReadOnly interface. This means your Model implementation must provide at least all methods of the interfaces combined.

Illustration:

classDiagram
    class SkyjoModelReadOnly {
        <<interface>>
    }

    class SkyjoModel {
        <<interface>>
    }

    class YourImplementation {
    }

    SkyjoModelReadOnly <|-- SkyjoModel
    SkyjoModel <|.. YourImplementation

Both interfaces are provided:

You'll also see that some methods refer to two additional interfaces. The code is of course provided:

Note: For Card you'll need to implement a toString method, returning always a two character value, for the model to be visualized correctly.

If you're missing any other provided classes, just visit the interfaces repository: https://gitlab.info.uqam.ca/mgl7010/interfaces/

Interfaces are documentation.

For java interfaces, it is common practice to generate a human-readable website with all details. This is also the case for all interfaces needed for this TP. You can convenienlty browse them at: https://mgl7010.pages.info.uqam.ca/interfaces/

Methods

  • The model interface methods are only basic getters and setters.
  • You are requested to provide an OO-conform implementation, that is:
    • Make sure it is not possible to manipulate state without passing through getters and setters.
    • Make sure state cannot be modified when your implementation is accessed through methods of the ReadOnly interface:
      • Protect class secrets, make sure to never pass an original object reference through a getter.
      • For object return values, return a copy or ensure the objects are immutable.

Start with the getters

The graphical interface only invokes getter methods, i.e. methods from the SkyjoModelReadOnly.java interface. Start your implementation with these methods, for they are sufficient to display your model.

Implementation details

  • Your Skyjo model will need a data structure to handle card decks.
    • Implement this data structure from scratch, i.e. do not use lists, arrays, etc to realize the decks. Implement your own dedicated class instead.
    • Do not use an existing java collection or array for this task.

Modularize your model

If you place your entire model implementation into a single class it will be gigantic, and a nightmare to develop. Before you start to code, think of model components that could be conceptualized into dedicated classes. A good candidate might be a Player class, representing cards held by a specific player.

Visualization

For your convenience, a Launcher and Model Visualizer is likewise provided.

  • The provided UI can be used to test your own implementation before submission.
  • Using the provided launcher code, your model should display correct game start information:
    • Deck, discard pile information (you can ignore Buffer)
    • Player names, their scores.
    • Player cards, at least two cards revealed per player.
  • The initial state must not be hard coded, i.e. every time your program is launched, a different initial setup must be displayed.

Note: The displayed information myst be coherent, i.e. the amount of cards and information displayed must be consistent to the game rules and material.

Illustration

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

Max  (-1)        Ryan  (8)        Maram  (17)      QUENTIN  (18)
    [??] [??] [-1]   [??] [??] [??]   [11] [??] [ 6]   [??] [??] [ 8]
    [??] [ 0] [??]   [ 5] [??] [ 3]   [??] [??] [??]   [10] [??] [??]

    0: Take deck card.

Compatibility

To ensure compatibility:

  • Do not make changes to the provided launcher and visualizer code.
  • Include all provided source code into your submission.

Contribution statement

Include a PDF file with the following information and statement:

Information

Per team member:

  • the percentage of work they contributed.
  • 2 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 code for this TP, and have not copied code from other sources without giving credit in the program comments. We understand that including AI generated code 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: ____

Submission

Submission is due by 03-10-2025 per email to schiedermeier.maximilian@uqam.ca.

  • Subject TP1
  • Content:
    • Single zip file with java sources (Do not submit your class files!)
    • Contribution statement, signed.

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 contribution statement: -100%, avoid at all costs.
  • Provided interfaces modified or not used, i.e. no implements SkyjoModel : -100%, avoid at all costs.
  • Code does not compile with javac LauncherTP1.java, version 24: -100%, avoid at all costs.
  • Code crashes upon execution with java LauncherTP1, version 24: -100%, avoid at all costs.
  • Additional non-jdk dependencies added / third party libraries used: -100%, avoid at all costs.
  • Deck not implemented with own data structure: -30%
  • State is hard coded / does not change on restart: -20%
  • Missing/incomplete model method implementations: -10% per missing / incomplete method.
  • Overly complicated methods: -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.