Advanced Programming Techniques

COSC1076 | Semester 1 2021

Assignment 2 | Implementing Qwirkle



3 Deliverables

3.1 Mandatory Requirements

As part of your implementation, you must:

• Implement your own Linked List

• Use your Linked List implementation to store the player’s hands and the tile bag.

• You should use vectors to store the current board state.

• You may only use the C++14 STL. You may not incorporate any additional libraries.

If you fail to comply with these mandatory requirements, marks will be deducted.


3.2 Milestone 1: Test Cases (Group Component)

For Milestone 1, you must develop test cases for your Qwirkle implementation, including your enhancements. These test cases will help ensure that your Qwirkle implementation is correct.

A single test case consists of 4 files, 2 mandatory and 2 optional.

1. .input - Input to provide to the Qwirkle program via stdin

2. .output - Expected output from the Qwirkle program on stdout

3. (Optional) .save - Input save file to provide to the Qwirkle program if required by the test.

4. (Optional) .expsave - Expected output saved game file.

A test is run using the following sequence of commands.

If this command displays any output, then the test has failed. Testing uses the diff command. This command checks to see if two files have any differences. The -w options ignores any white-space.

To make testing reliable, you should note if the test evaluates the saved game output, then ensure the test uses a suitable filename in place of .


3.3 Milestone 2: Basic Qwirkle Implementation (Group Component)

For Milestone 2, your group must implemented the base Qwirkle program as described in Section 2.

Section 2 lists the components that your group must implement. Generally, it is up to your group to decide the best way to implement these components. However, there are some important requirements that your group must satisfy.

Aspects of this specification are flexible and open to your interpretation. It is up to your group to determine the best course of action. You will need to analyse and justify your choices in the report.


3.3.1 Requirements

Your group will implement a game of Qwirkle that:

• Is a 2-player game.

• Both players are “human users” that play the game by interacting with the terminal, that is, through standard input/output.

• Using the Qwirkle board of fixed size.

You will implement a simplified version of Qwirkle. These changes are listed in section 2.5.

Your implementation should provide the following functionality:

• A main menu, that allows users to perform actions such as setting up a new game, loading an existing game, showing “credits” (details of the people who wrote the software), and quitting the program.

• Save a game to a file.

• Load a previously saved game from a file, and resume game play from the saved state.

• A way to represent and display the Qwirkle board and player hands the user.

• A User prompt for entering all commands from standard input.

• Base gameplay functionality as described in Section 2.3.

• The program should terminate without crashing if the EOF character is given on standard input.

• Completely error free. Your program must not crash, segfault or otherwise contain logic errors.

Your group will also need to consider the data structures that are used to represent aspects of Qwirkle, and functionality. It is up to your group to make this decision provided that you meet the requirements in section 3.1. In your report your group will be marked on your analysis of the above choices.

Finally, remember to do the the group contribution spreadsheet described in 5.3.


3.4 Milestone 3: Enhancements (Individual Component)

In Milestone 3, as an individual you will make signification expansions(s) to the functionality of your group’s Qwirkle program. This milestone is your opportunity to showcase to us your skills, capabilities and knowledge! You will select your enhancements from the provided options in Section 4. Additionally, if you group’s Milestone 2 solution has significant errors or is significantly incomplete, please read Section 4.3.

Milestone 3 is a very open-ended. You are given some directives, however, there is a lot of room for you to make considered choices. However, this showcase of your skills is not just about “making the code work”. A major focus is on how you choose to implement an enhancement, and the justifications of the reasons why you chose a given data structure, class hierarchy, language feature, or algorithm to name a few examples. Enhancements are classified as minor or major. Enhancements must be substantially functional to get marks.

To get a higher grade you will need to implement one or more minor or major enhancements. This is described in the marking rubric.


3.4.1 Configurable Enhancements

Where reasonably possible, your enhancements should be configurable. That is, it should be possible to en-able/disable each enhancement at run-time (not through compilation). In particular, this means your enhance-ments can be “turned-off” so that your program runs the same as Milestone 2 (verbatim).


3.4.2 Changes to Saved Game file

Some enhancements may require you to modify the format of the saved-game file. However, it is recommended that your program with enhancements still supports loading games from the default saved-game format used in Milestone 2.

To distinguish your new saved-game format from the “default” milestone 2 format, we recommend adding a special code at the start of your new saved-game format, such as:


3.5 Milestone 4: Written report & Demonstration (Group + individual Compo-nent)

3.5.1 Written report

Your group must write a report, that analyses what your group has done in this assignment. Additionally, each individual must write a short report that analyses their individual enhancement(s). The group should combine the group report and the individual report and one group member should submit it via canvas. The combined report is due at the same time as the individual submission (11.59pm, Friday 28 May 2021).

• The report should be A4, 11pt font, 2cm margins and single-space.

• The section of the report describing the group’s work must be no more than 4 pages.

• Each individual must add 1 additional page about their enhancements.

• Thus the final report must not exceed 8 pages for a group of four.

• Only the first 4 pages (group), and 1 page (individual) will be marked.

• Modifying fonts and spacing will count as over length.

• Figures, Tables and References count towards these page limits.

In this assignment, you are marked on the analysis and justification of the choices you have made. Your report will be used (in conjunction with the demonstration) to determine the quality of your decisions and analysis.

Good analysis provides factual statements with evidence and explanations.

Statements such as:

“We did because we felt that it was good” or “Feature is more efficient”

do not have any analysis. These are unjustified opinions. Instead, you should aim for:

“We did because it is more efficient. It is more efficient because . . . ”

We are asking for a combined report as it keeps the context of each individual’s enhancements with the whole group’s original implementation.


3.5.2 Group Component of the Report

In the group section of your report, you should discuss aspects such as:

• Your group’s use of at least one linked list, and the reasons for where the linked list is used.

• Your group’s choices of ADTs, and how these leads to a “well designed” program.

• The efficiency of your implementation, such as the efficiency of your use of data structures.

• The reason for each of your tests.

• Your group co-ordination and management.


3.5.3 Individual Component of the Report

In the individual section of your report, you should discuss aspects such as:

• The design of your enhancements, including any changes (and additions) to the data structures and ADTs you had to make when enhancing your group’s implementation.

• The efficiency of your enhancements, such as the efficiency of your use of data structures.

• Limitations and issues that you encountered with your group’s implementation.


3.5.4 Demonstration

The demonstration will be conducted virtually. More information on the demonstration and how to conduct it will be provided in week 11.


4 Suggested Enhancements for Milestone 3

4.1 Minor enhancements

Minor enhancements are smaller in scope, and require only a small modification to your software design.


4.1.1 Help!

Whenever there is a user prompt, the user may type “help” and the program should display some text to help the user determine what they commands they may execute.


4.1.2 Better Invalid Input

Whenever the user enters invalid input at the user prompt, the program should show a useful error message to explain why the input was invalid.


4.1.3 Colour

Use colour to display tiles on the board and in the player’s hand. The Linux, Mac (and most similar) terminals support the use of colour through the use of escape codes. A simple internet search will show you tutorials for working with escape codes.


4.1.4 Unicode/Emoji Tile Symbols

Use Unicode or Emoji for displaying tiles when printing information for the users to stdout. You can embed Unicode symbols or Emoji symbols directly into C++ files when used for writing information to output streams. Most modern terminals also support the display of unicode symbols and emoji.

However, the saved game file must still be plain-text, and use the tile codes listed in Section 2.3.1.


4.1.5 Simple Hints

Provide a hint to the user of where a given tile could be placed on the board, and how many points the user will score. You will need to invent your own command so the user can ask for a hint.


4.1.6 Expandable Board

The board should only display enough rows and columns to fully show the board, plus one additional empty row and column around the edge of the board. Any additional empty rows and columns should not be displayed.


4.1.7 High Scores

The program maintains a list of high scores achieved by any player who has played your game of Qwirkle. You will need to devise a way to save, load, and display the high scores.


4.2 Major enhancements

Major enhancements are large in scope, and require significant modifications to your software design.


4.2.1 3-4 Player modes

Implement the 3 or 4-player mode of Qwirkle. You will need to change the number of tiles in each player’s hand according to the rules of Qwirkle. This will also affect the format of the saved game file.


4.2.2 Place Multiple Tiles

Allow a player to place multiple tiles. You will need to invent your own command(s).


4.2.3 Write an AI

It would be nice to play Qwirkle in a single-player mode against the computer. This enhancement requires you to develop an AI (Artificial Intelligence) so that your program can be used in single-player mode, and a person can play against the computer AI. When it’s the AI’s turn, it should make its move automatically without the user having to input a command.

An AI implies intelligence. An AI doesn’t take random actions. It uses logic and heuristics to determine a “good” move, and hopefully the “best” action to take. Heuristics are ways to “guess” or “estimate” if an action is good or bad. Thus, your AI needs to have “intelligence” to figure out a good action to take on its turn. You may not be able to decide the “optimal” action, however, the choice must be better than a random action.

For this enhancement, you may wish to consider:

• You may need to redesign and change the data structures that are used to represent Qwirkle. However, you must still meet the mandatory minimal use of each data structure as given in Milestone 2.

• The AI should not take a long time to calculate its move.

• You will need to modify the saved-game format to record if an AI is being used.

In your individual report you should justify why your AI has a “good” heuristic and is intelligent. You should also describe any significant changes to the choice of data structure(s) describe and justify any other necessary changes to your group’s Qwirkle program.

We recommend that the AI is enabled using a command-line argument, such as:

(Note two dashed are used in due to the Unix command-line argument styles for multi-letter arguments.)


4.3 Milestone 2 Code with Significant Errors

This section is a general statement. This is provided as a starting point from which to approach your tutor. This option may only be used if you have discussed the matter with your tutor.

It is possible that your group’s Qwirkle program may contain errors. If the errors in the your group’s Qwirkle program are small, while you should fix these in your individual work, they are not considered a significant change.

However, if your group’s Qwirkle program has significant errors or is missing significant functionality, then you may be able to negotiate with your tutor to fix these error as a minor enhancement. As each group’s program is different, this will be determined on a case-by-case basis.

Please note that this does not excuse you from failing to make sufficient contributions to your group. While you may be able to “make-up” some functionality in this milestone, you should not use this as an excuse to make an insufficient contribution.



5 Managing Group Work

This group assignment can be conducted entirely online, without you ever meeting your group members face-to-face. This isn’t a problem, with the available online tools. The challenge for you will be using these tools effectively. You will need to make extra efforts and be very dedicated and diligent in working with your team members. This will include setting up dedicated times for meetings and group programming sessions.


5.1 Group Work Tools

To help manage your group work, and demonstrate that you are consistently contributing to your group, we are going to require you to use a set of tools.


5.1.1 MS Teams

Each group will be required to create a team on the RMIT MS Teams platform. Your group must add your tutor(s) to your MS team2.

Your MS team will be the only official communication platform for the assignment. This means you must:

• Only use the MS Team channels for group chats

• Hold all team meeting through MS Teams and record all team meetings (except for the conversations in the lab sessions).

• Store any group files (not in Git) in the MS Team

If there are disputes, we will use the record on MS Teams as the source of evidence. You may not use other platforms (including Discord) as we cannot verify the identify of the users.


5.1.2 Git Repository

Your group must have a private Git repository that hosts your group’s code. This may be on BitBucket or Github. Your group must add your tutor(s) to this repository3 . This git repository will be used as the evidence of your individual contribution to your group.

For the individual component you should copy/fork the repository before commencing your individual work.


5.2 Suggested Weekly Schedule

On Canvas, we have provided a spreadsheet that contains a schedule of the suggested tasks your group should finish each week. Additionally, in the labs your tutor will compare your group’s progress to this schedule. The tasks are flexible if your group runs into issues, such as a student being sick. However, you must inform your tutor of any issues so that you can negotiate with your tutor to rearrange the tasks.


5.3 Group Contributions

For Milestone 1 and 2 you will need to provide a record of your contribution to your group. This record is also contained on the schedule spreadsheet which has a location where each student can record their contributions. You should also note any issues that your have encountered on this spreadsheet.


5.4 Notifying of Issues

If there are any issues that affect your work, such as being sick, you must keep your group informed in a timely manner. Your final grade is determined by you (and your group’s) work over the entire period of the assignment. We will treat everybody fairly, and account for times when issues arise when marking your group work and contributions. However, you must be upfront and communicate with us.

If you fail to inform us of issues in a timely fashion and we deem that your actions significantly harm your group’s performance, we may award you a reduced grade. It is academic misconduct if you are deliberately dishonest, lie to, or mislead your group or teaching staff in a way that harms your group.


6 Getting Started

6.1 Designing your Software

This assignment requires you and your group to design the ADTs and Software to complete your implementation. It is up to your group to determine the “best” way to implementing the program. There isn’t necessarily a single “right” way to go about the implementation. The challenge in this assignment is mostly about software design, not necessarily the actual game-play.

Trying to solve the whole program at once is too large and difficult. So to get started, the best thing to do is start small. You don’t have to figure out the whole program at once. Instead, start with the smallest working program. Then add a small component, and make sure it is working. Then keep adding components to build up your final program.

You can get help about your ideas and progress through the lab updates. This is where you can bring your ideas to your tutor and ask them what they think. They will give some and ideas for your progress.


6.2 Starter Code

The start-up code is very limited. It contains the following files:


7 Submission

Follow the detailed instructions on Canvas to complete your submission for Assignment 1.

Assessment declaration: When you submit work electronically, you agree to the assessment declaration.


7.1 Silence Period

A silence policy will take effect from 5.00pm, Thursday 27 May 2021. This means no questions about this assignment will be answered, whether they are asked on the discussion board, by email, or in person. Make sure you ask your questions with plenty of time for them to be answered.


7.2 Late Submissions, Extensions & Special Consideration

Late submission accrue a penalty of 10% per day up to 3 days, after which you will lose ALL the assignment marks. The late penalty for Milestone 1, 2 is applied to the group component of the assignment mark. The late penalty for Milestone 3, 4 is applied to the individual component of the assignment mark.

Extensions will not be given for this assignment.

Where special consideration is granted, generally it is awarded on an individual basis, not for the entire group. Extensions of time will not be granted, instead an equivalent assessment will be conducted which may take the form of a written and practical coding exercises. This equivalent assessment covers the non-group components of the rubric. The group-work component will be assessed on your group participation for the duration of Assignment 2 for which you were unaffected and able to contribute. This will take into consideration how well you kept your group informed of your ability to work and contribute to the group.


7.3 Group Work Penalties

In severe cases of poor group work:

• We may apply an individual mark to any or all categories of the rubric.

• We may file a charge of academic misconduct if we determine that a student has been deceitful or untruthful in a manner than has a severe adverse academic impact on the other students in the group.


8 Marking guidelines

The detailed breakdown of this marking guidelines is provided on the rubric linked on Canvas. The marks are divided into the following categories:

• Group Component (30/45):

– Qwirkle Implementation: 15/45

– Test Cases: 5/45

– Analysis & Design: 5/45

– Group Work: 5/45

• Individual Component (15/45):

– Individual Enhancements Implementation: 10/45

– Individual Enhancements Analysis: 5/45


9 Academic integrity and plagiarism (standard warning)

CLO 6 for this course is: Demonstrate and Adhere to the standards and practice of Profes-sionalism and Ethics, such as described in the ACS Core Body of Knowledge (CBOK) for ICT Professionals.

Academic integrity is about honest presentation of your academic work. It means acknowledging the work of others while developing your own insights, knowledge and ideas. You should take extreme care that you have:

• Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in your assessment through the ap-propriate referencing methods

• Provided a reference list of the publication details so your reader can locate the source if necessary. This includes material taken from Internet sites. If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed off the work and ideas of another person without appropriate referencing, as if they were your own.

RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism covers a variety of inappropriate behaviours, including:

• Failure to properly document a source

• Copyright material from the internet or databases

• Collusion between students

For further information on our policies and procedures, please refer to the RMIT Academic Integrity Website.

The penalty for plagiarised assignments include zero marks for that assignment, or failure for this course. Please keep in mind that RMIT University uses plagiarism detection software.