COMP 1046 Object-Oriented Programming
Object-Oriented Programming
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP 1046
Object-Oriented Programming
Assignment
Mastermind Game Development
Part 2 - Implementation
WARNING
This material has been reproduced and communicated to you by or on behalf of the University of
South Australia in accordance with section 113P of the Copyright Act 1968 (Act). The material in
this communication may be subject to copyright under the Act. Any further reproduction or
communication of this material by you may be the subject of copyright protection under the Act.
Introduction
The assignment is intended to provide you with the opportunity to put into practice what you have
learnt in the course by applying your object-oriented programming knowledge and skills. It will
require you to apply object-oriented methods to design, implement, and test a text-based
application software where users can play a Mastermind game.
The assignment is worth for 30% of the assessment in this course, and consists of two parts:
• Part 1 – Design (10%)
• Part 2 – Implementation (20%)
This document specifies the tasks for Part 2 of the assignment which is Python implementation of
the software, while it should be read in conjunction with the Part 1 specification on design provided
as a separate document on the course website.
This assignment (Part 2) is an individual task that will require an individual submission. You are
required to submit your work via course website as prescribed in the Submission Details section.
This document is a kind of specification of the required end product that will be generated by
implementing the assignment. Like many specifications, it is written in English and hence will contain
some imperfectly specified parts. Please make sure you seek clarification if you are not clear on any
aspect of this assignment.
Course Objectives
By completing this assignment, you are expected to partially fulfill the following course objects:
• CO1. Convert a problem statement into an object oriented solution
• CO2. Use inheritance and polymorphism to solve problems
• CO3. Debug and fix code defects
• CO4. Apply international coding style standards
• CO5. Plan and conduct testing of software
• CO6. Analyse and explain the behaviour of object oriented programs
Assignment Learning Outcomes
• Implement an Object-Oriented designed software in Python.
• Apply object-oriented principles including abstraction, data hiding, encapsulation,
inheritance, and polymorphism to software implementation.
• Practice Python programming skills including commenting with docstrings, handling
exceptions, conducting unit tests, and version control with git.
The Assignment Task Specification
The task for the Part 2 of the assignment is to implement the World of Mastermind (WoM) in
Python, a text-based application software designed in Part 1 of the assignment. The assignment will
require you to revise your design in UML, implement, test, and debug the software practising object-
oriented programming principles and Python programming skills. In addition, the assignment will
require you to use version control to keep track of your implementation as you progress through the
assignment and to document your classes appropriately.
Requirement 0. Header comment with personal details.
All of the Python files you submit must have the following block of comments at the top including
the filename, description, and your student details:
#
# File: filename.py
# Descrition: A brief description of this Python module.
# Author: Steve Jobs
# Student ID: 12345678
# Email ID: jobst007
# This is my own work as defined by
# the University's Academic Misconduct Policy.
#
Requirement 1. Correct implementation in Python according to the specification in Part 1.
Your implementation must be in Python 3.9. Your submission must implement all the features to
correctly produce the behaviours and output as specified in the Assignment Part 1 specification
document. Make sure you have a good review of the “The Assignment Task Specification” section in
the Assignment Part 1 specification document which describes the features and behaviours of the
World of Mastermind software in details with sample outputs. The submission will be marked
against these specifications and sample output provided in the Assignment Part 1 document.
One exception is to show the computer-generated hidden code on the screen so it will be useful for
the testing purpose (shown in bold character):
* HAL9000's turn to set the code for Alan to break.
DEBUG: RGBY
The code is now set for Alan to break.
Requirement 2. Apply proper Object-Oriented design principles to implementation.
Your implementation must practice Object-Oriented design principles as following:
1) Abstraction
Your implementation must include definition of at least 5 classes including the
WorldOfMastermind class. All of your code must belong to one of the classes you define,
except the import statements and the following code which will run the software:
wom = WorldOfMastermind()
wom.run()
This run() method in the WorldOfMastermind class must be the starting point of your
software and call methods of other objects in the system.
2) Data Hiding and Encapsulation
All of the data attributes defined in your classes must be private. In addition, following conditions
must be met on particular attributes:
- Player’s (or user’s) name must not be changeable once initialised (i.e., must be read only).
- User’s score must be only allowed for being increased by an asked amount but never to be
set with a value. (i.e., no setter method, but with a method to increase the score)
- The hidden code on a decoding board must be only settable (i.e., once set, its value never
can be accessed from outside the class that it belongs to, but can ask for feedback providing
a guessed code.)
3) Inheritance and Polymorphism
There should be at least one inheritance relationship used and at least one instance of practicing
polymorphism (i.e., overriding a method in the superclass). Overriding an initialiser or string
conversion method is not counted in this requirement (i.e., you must override a method you
defined in the superclass). A subclass must not repeat the code already in its superclass.
Requirement 3. Documentation with docstrings.
Your code must be documented appropriately using docstrings. If you are not familiar with
docstrings, please review week 1 tutorial or the section “Explaining yourself” in the textbook on
page 42 for more information.
Each class and each method should have at least one docstring which can be brief. The
responsibilities that you have specified in the UML diagram can be used as a starting point for the
class docstring.
Document as you go, not all at the end. One strategy is to write a brief comment about what the
"1 thing" the method is supposed to do when you declare it, then refer to that comment while
implementing it: this helps maintain focus when implementing the method and helps stop yourself
from making it do more than the '1' thing it is supposed to do.
Requirement 4. Use consistent coding style.
Your Python code must adhere to consistent coding style. Your class names must be in
CapitalCamelCase style, while the methods and attributes could be in either
smallCamelCase or under_score style. While you may use one or the other it should be
consistent throughout your code. If you are note sure, follow the Python style guide available here:
https://www.python.org/dev/peps/pep-0008/
Requirement 5. Use exception handling.
Your implementation must use exception handling for dealing with incorrect user inputs or any other
type of exceptions. For example, your program should not halt (a.k.a. crash) if the user gives non-
numerical input where a number is expected, but rather handle such exceptions using try-except
statements.
Requirement 6. Version control using git.
You must use git version control to keep track of your progress during implementation. If you are not
familiar with git, please review the workshop material on Week 5.
(Note: Only the local git repository is required in this assignment. You are not required to use an
online version control repository, but if you choose to, please make sure your repository is private.)
You should perform regular commits as you implement features and fix errors (at least 10 commits
must be made). Ensure each commit comment contains a short subject line. Your commit comments
should reflect the context of the changes that were made in each commit—a fellow developer can
always diff the contents to see exactly what changed but that does not provide the context.
Your submission should comprise your entire version control repository specific to the assignment.
For example, you must create the git repository in the directory for your assignment project. Do not
commit your assignment to a repository created in a parent folder or any other location. Your
repository must contain all source files required to run your program.
Requirement 7. Conduct testing.
Your submission must include Python module(s) for testing. It is recommended that you test
individual methods as you go, rather than trying to test the whole application through the menu-
driven interface. Writing code to test specific elements will speed up development as you will not
need to constantly enter data through the menu interface.
Your submission should have code for testing the methods of each class you define.
Requirement 8. Updated UML diagram
Update the UML diagram as you implement the program. You will need to submit an updated UML
diagram with your submission.