1. Homepage
  2. Programming
  3. CSSE1001/CSSE7030 Assignment 2: Fancy Sokoban

CSSE1001/CSSE7030 Assignment 2: Fancy Sokoban

Engage in a Conversation
UQCSSE1001CSSE7030Introduction to Software EngineeringPythonFancy Sokoban

1 Introduction CourseNana.COM

Fancy Sokoban CourseNana.COM

Assignment 2 Semester 1, 2023 CSSE1001/CSSE703 CourseNana.COM

Sokoban is a simple game in which a player tries to push crates onto goal locations in a grid. In assignment 2, you will create a slightly modified text-based version of Sokoban, in which the player may also need to collect potions in order to be able to push all crates to goal locations within an allocated number of moves. Your implementation will follow the Apple Model-View Controller (MVC) structure mentioned in lectures. CourseNana.COM

You are required to implement a collection of classes and methods as specified in Section 5 of this document. Your program’s output must match the expected output exactly; minor differences in output (such as whitespace or casing) will cause tests to fail, resulting in zero marks for those tests. Any changes to this document will be listed in a changelog on Blackboard, and summarized on the Edstem megathread. CourseNana.COM

2 Getting Started CourseNana.COM

Download a2.zip from Blackboard — this archive contains the necessary files to start this assignment. Once extracted, the a2.zip archive will provide the following files / directories: CourseNana.COM

a2.py CourseNana.COM

The game engine. This is the only file you submit and modify. Do not make changes to any other files. a2_support.py CourseNana.COM

Classes, functions, and constants to assist you in some parts of the assignment. CourseNana.COM

maze_files CourseNana.COM

A collection of files to be used to initialize games. CourseNana.COM


A folder containing example output from running a full solution to the assignment. CourseNana.COM

3 Terminology & Gameplay CourseNana.COM

In Fancy Sokoban, a player appears in a grid, which is made up of tiles. Tiles may be a wall, floor, or goal. There are a number of movable entities that exist on the grid. The player (as a moveable object on the grid) is themself an entity. Other entities include crates and various types of potions. The objective of the game is for the player to push the crates onto the goal locations such that every goal tile is filled (covered by a crate). Every game has exactly as many crates as it has goals. CourseNana.COM

The player has a limited number of moves available, and starts with an initial strength. Crates also have a strength value, which represents the strength required to push them. CourseNana.COM

A player cannot move through a wall or through a crate. A crate cannot move through a wall or through any other entity (including other crates). Potions are collectable entities that can be applied to increase a player’s strength and/or number of moves remaining, thereby allowing them to complete games they may otherwise be unable to complete. CourseNana.COM

At the beginning of the game, the initial game state is shown (including the grid with all entities, and player statistics). The user (person controlling the player) is then repeatedly prompted for a move. Valid moves and their corresponding behaviours are shown in Table 1. If a user enters anything other than these valid commands at the move prompt, the text ‘Invalid move.’ should be displayed, then the game state should be displayed CourseNana.COM

and the user should be reprompted for another move. CourseNana.COM

Move name CourseNana.COM

‘a’ ‘w’ ‘s’ ‘d’ ‘q’ CourseNana.COM

Behaviour CourseNana.COM

The player attempts to move left one square.
The player attempts to move up one square.
The player attempts to move down one square.
The player attempts to move right one square.
The player quits the game. The program should terminate gracefully.

Table 1: The behaviour of commands a user can input at the prompt for a move. CourseNana.COM

The game is over when the player has either: CourseNana.COM

  • Won by placing all crates on goals (or equivalently, having all goals be filled) CourseNana.COM

  • Lost by running out of moves CourseNana.COM

  • Quit by entering ‘q’ at the move prompt. CourseNana.COM

    You do not need to handle informing the user if the game has become unwinnable; you may assume they will CourseNana.COM

have to quit to end the game in this case. CourseNana.COM

4 Class overview and relationships CourseNana.COM

You are required to implement a number of classes in this assignment. The class diagram in Figure 1 provides an overview of all of the classes you must implement in your assignment, and the basic relationships between them. The details of these classes and their methods are described in depth in Section 5. CourseNana.COM

You should develop the classes in the order in which they are described in Section 5, and test each one (including on Gradescope) before moving on to the next class. Functionality marks are awarded for each class (and each method) that work correctly. You can pass the assignment, and indeed do quite well, without implementing every class. Conversely, you will do very poorly on the assignment if you submit an attempt at every class, where no classes work according to the description. Some classes require significantly more time to implement than others. For example, Tile and its subclasses will likely be substantially shorter than SokobanModel. The marks allocated to each class are not necessarily an indication of their difficulty or the time required to complete them. CourseNana.COM

  • Orange classes are classes that are provided to you in the support file. CourseNana.COM

  • Green classes are abstract classes. However, you are not required to enforce the abstract nature of the green classes in their implementation. The purpose of this distinction is to indicate to you that you should only ever instantiate the blue and orange classes in your program (though you should instantiate the green classes to test them before beginning work on their subclasses). CourseNana.COM

  • Hollow-arrowheads indicate inheritance (i.e. the “is-a” relationship). CourseNana.COM

  • Dotted arrows indicates composition (i.e. the “has-a” relationship). An arrow marked with 1-1 denotes that each instance of the class at the base of the arrow contains exactly one instance of the class at the head of the arrow. An arrow marked with 1-n denotes that each instance of the class at the base of the arrow may contain many instances of the class at the head of the arrow. CourseNana.COM

    5 Implementation CourseNana.COM

    This section outlines the classes, methods, and functions that you are required to implement as part of your assignment. It is recommended that you implement the classes in the order in which they are described. Ensure each class behaves as per the examples (and where possible, the Gradescope tests) before moving on to the next class. CourseNana.COM

    5.1 Tiles CourseNana.COM

    Tiles are used to represent the game grid (i.e. the floor on which the entities exist). All instantiable tiles inherit from the abstract Tile class, and should inheret the default Tile behaviour except where specified in the descriptions of each specific type of tile. CourseNana.COM

Figure 1: Basic class relationship diagram for the classes which need to be implemented for this assignment. CourseNana.COM

Tile (abstract class) CourseNana.COM

An abstract class from which all instantiable types of tiles inheret. Provides the default tile behaviour, which can be inhereted or overwritten by specific types of tiles. The __init__ methods for all tiles do not take any arguments beyond self. CourseNana.COM

is_blocking(self) -> bool (method) Returns True only when this tile is blocking. A tile is blocking if an entity would not be able to move onto that CourseNana.COM

tile. By default, tiles are non-blocking.
get_type(self) -> str (method) CourseNana.COM

Returns a string representing the type of this tile. For the abstract Tile class, this method returns the string ‘Abstract Tile’. For instantiable subclasses, this method should return the single letter constant corresponding to that class. CourseNana.COM

__str__(self) -> str (method) Returns a string representing the type of this tile. In most cases, this will be the same string as would be CourseNana.COM

returned by get_type. __repr__(self) -> str CourseNana.COM

Operates identically to the __str__ method. Examples CourseNana.COM

(method) CourseNana.COM

>>> tile = Tile()
>>> tile.is_blocking()
>>> tile.get_type()
'Abstract Tile'
>>> str(tile) # note that this is a demo of the __str__ method
'Abstract Tile'
>>> tile # note that this is a demo of the __repr__ method
Abstract Tile

Floor (class) CourseNana.COM

Inherits from Tile CourseNana.COM

Floor is a basic type of tile that represents an empty space on which entities can freely move. It is non-blocking and is represented by a single space character.
Examples CourseNana.COM

>>> floor = Floor()
>>> floor.is_blocking()
>>> floor.get_type()
>>> str(floor)
>>> floor # note that the below output contains a space character without quotation marks CourseNana.COM

Wall (class) CourseNana.COM

Inherits from Tile CourseNana.COM

Wall is a type of tile that represents a wall through which entities cannot pass. Wall tiles are blocking, and are represented by the character ‘W’.
Examples CourseNana.COM

>>> wall = Wall()
>>> wall.is_blocking()
>>> wall.get_type()
>>> str(wall)
>>> wall

Goal (class) CourseNana.COM

Inherits from Tile CourseNana.COM

Goal is a type of tile that represents a goal location for a crate. Goal tiles are non-blocking, and the type is represented by ‘G’. Goal tiles can either be filled (e.g. contain a crate) or unfilled (e.g. empty, with room for one crate). Goal tiles start unfilled, and become filled throughout gameplay as the player pushes crates onto them. If a goal tile is unfilled, the __str__ and __repr__ methods return ‘G’. However, when a goal tile becomes filled, the __str__ and __repr__ methods should instead return ‘X’ to denote that this goal tile is filled. In addition to the regular Tile methods that the Goal must support, this class should also implement the following methods: CourseNana.COM

 is_filled(self) -> bool

Returns True only when the goal is filled. CourseNana.COM

 fill(self) -> None

Sets this goal to be filled. CourseNana.COM

Examples CourseNana.COM

(method) (method) CourseNana.COM

>>> goal = Goal()
>>> goal.is_blocking()
>>> goal.get_type()
>>> str(goal)
>>> goal
>>> goal.is_filled()
>>> goal.fill()
>>> goal.is_filled()
>>> goal.get_type()
>>> str(goal)
>>> goal

5.2 Entities CourseNana.COM

Entities exist on top of the grid (i.e. on top of the tiles), and include the player, all crates, and all potions. Entities may or may not be movable. CourseNana.COM

Entity (abstract class) Abstract base class from which all entities inherit. The __init__ methods for this class does not take any CourseNana.COM

arguments beyond self.
get_type(self) -> str (method) CourseNana.COM

Returns a string representing the type of this entity. For the abstract Entity class, this method returns the string ‘Abstract Entity’. For instantiable subclasses, this method should return the single letter constant corresponding to that class. CourseNana.COM

is_movable(self) -> bool (method) Returns True iff this entity is movable. By default, entities are not movable. CourseNana.COM

__str__(self) -> str (method) Returns a string representing the type of this entity. In most cases, this will be the same string as would be CourseNana.COM

returned by get_type. __repr__(self) -> str CourseNana.COM

Operates identically to the __str__ method. Examples CourseNana.COM

(method) CourseNana.COM

>>> entity = Entity()
>>> entity.get_type()
'Abstract Entity'
>>> entity.is_movable()
>>> str(entity)
'Abstract Entity'
>>> entity
Abstract Entity

Inherits from Entity CourseNana.COM

Crate is a movable entity, represented (in get_type) by the letter ‘C’. Crates are constructed with a strength value, which represents the strength a player is required to have in order to move that crate. The string representation of a crate should be the string version of its strength value. You may assume that the strength values will always be between 0 and 9 inclusive. CourseNana.COM

Note: blocking players from moving crates that they are not strong enough to move should not be handled by the crate class. A crate only needs to be aware of its own strength requirement, and provide an interface through which the model class can access that information. CourseNana.COM

In addition to the regular Entity methods, the Crate class is required to implement the following methods: __init__(self, strength: int) -> None (method) CourseNana.COM

Ensure any code from the Entity constructor is run, and set this crate’s strength value to strength. get_strength(self) -> int (method) CourseNana.COM

Returns this crate’s strength value. CourseNana.COM

Examples CourseNana.COM

>>> crate = Crate(4)
>>> crate.get_type()
>>> crate.is_movable()
>>> str(crate)
>>> crate # Note that this is a string displaying without quotation marks
>>> crate.get_strength() # Note that this is an integer

Potion (abstract class) CourseNana.COM

Inherits from Entity CourseNana.COM

This is an abstract class which provides a simple interface which all instances of potions must implement. The __init__ method for all potions do not take any arguments besides self. Since this class inherits from Entity, it (along with its subclasses) should also provide all methods available from the Entity class. Potions are not movable. An abstract potion is represented by ‘Potion’ and has no effect. CourseNana.COM

All potions must additionally implement the following method: CourseNana.COM

effect(self) -> dict[str, int] (method) CourseNana.COM

Returns a dictionary describing the effect this potion would have on a player. Note that potions are not responsible for applying their effects to a player; they only need to provide information about the effects they would cause. The abstract potion class should just return an empty dictionary, since it has no effect. CourseNana.COM

StrengthPotion (class) CourseNana.COM

Inherits from Potion CourseNana.COM

A StrengthPotion is represented by the string ‘S’ and provides the player with an additional 2 strength. CourseNana.COM

MovePotion CourseNana.COM

Inherits from Potion CourseNana.COM

A MovePotion is represented by the string ‘M’ and provides the player with 5 more moves. CourseNana.COM

FancyPotion CourseNana.COM

(class) CourseNana.COM

(class) CourseNana.COM

Inherits from Potion CourseNana.COM

A FancyPotion is represented by the string ‘F’ and provides the player with an additional 2 strength and 2 more moves. CourseNana.COM

Examples of Potions CourseNana.COM

>>> potion = Potion()
>>> print(potion.get_type(), potion.is_movable(), str(potion))
Potion False Potion
>>> potion.effect()
>> strength = StrengthPotion()
>>> print(strength.get_type(), strength.is_movable(), strength.effect(), str(strength))
S False {'strength': 2} S
>>> move = MovePotion()
>>> print(move.get_type(), move.is_movable(), move.effect(), str(move))
M False {'moves': 5} M
>>> fancy = FancyPotion()
>>> print(fancy.get_type(), fancy.is_movable(), fancy.effect(), str(fancy))
F False {'strength': 2, 'moves': 2} F

Player (class) CourseNana.COM

Inherits from Entity CourseNana.COM

Player is a movable entity, represented by the letter ‘P’. A player instance is constructed with a starting strength and an initial number of moves remaining. These two values can change throughout regular gameplay, or through the use of potions, via methods provided by the Player class. A player is only movable if they have a positive number of moves remaining. In addition to the regular Entity methods, the Player class is required to implement the following methods: CourseNana.COM

__init__(self, start_strength: int, moves_remaining: int) -> None (method) Ensure any code from the Entity constructor is run, and set this player’s strength to start_strength and CourseNana.COM

their remaining moves to moves_remaining. get_strength(self) -> int CourseNana.COM

Returns the player’s current strength value. CourseNana.COM

 add_strength(self, amount: int) -> None

Adds the given amount to the player’s strength value. CourseNana.COM

 get_moves_remaining(self) -> int

Returns the player’s current number of moves remaining. CourseNana.COM

 add_moves_remaining(self, amount: int) -> None

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

Adds the given amount to the player’s number of remaining moves. Note that amount may be negative. CourseNana.COM

apply_effect(self, potion_effect: dict[str, int]) -> None (method) Applies the effects described in potion_effect to this player. CourseNana.COM

Examples CourseNana.COM

>>> player = Player(1, 8)
>>> print(player.get_strength(), player.get_moves_remaining()) 18
>>> player.add_strength(2)
>>> player.add_moves_remaining(-3)
>>> print(player.get_strength(), player.get_moves_remaining()) 35

>>> potion = StrengthPotion()
>>> player.apply_effect(potion.effect())
>>> print(player.get_strength(), player.get_moves_remaining()) 55
>>> potion = MovePotion()
>>> player.apply_effect(potion.effect())
>>> print(player.get_strength(), player.get_moves_remaining()) 5 10
>>> potion = FancyPotion()
>>> player.apply_effect(potion.effect())
>>> print(player.get_strength(), player.get_moves_remaining()) 7 12

5.3 convert_maze CourseNana.COM

The read_file function in a2_support.py will return a tuple containing a representation of the maze (including tiles and entitites), and the player stats (strengths and moves remaining). The maze representation is in the format list[list[str]], where each string is a character representing either the tile or entity at that location. If an entity is present at a location, it is assumed that the tile underneath it is a floor tile. CourseNana.COM

You will need to convert this maze representation into more appropriate data structures containing instances of the classes you have just written. To do so, you must write the following function (as opposed to a method which exists within a class): CourseNana.COM

convert_maze(game: list[list[str]]) -> tuple[Grid, Entities, Position](function) This function converts the simple format of the maze representation into a more sophisticated representation. Namely, this function must construct the following structures: CourseNana.COM

1. A list of lists of Tile instances, representing the tiles on the grid.
2. A dictionary mapping (row, column) positions to
Entity instances. This dictionary only contains positions CourseNana.COM

on which entities exist, and does not contain the player, despite the fact that the player is an entity. 3. A tuple containing the (row, column) position of the player. CourseNana.COM

This function must then return a tuple containing these three structures (in order). CourseNana.COM

Examples CourseNana.COM

>>> raw_maze, player_stats = read_file('maze_files/maze1.txt')
>>> maze, entities, player_position = convert_maze(raw_maze)
>>> maze
[[W,W,W,W,W,W,W,W],[W,,,,W,, ,W],[W,, , ,W, , ,W], [W, , , , W, G, , W], [W, , , , , , , W], [W, , , , , , , W], [W, W, W, W, W, W, W, W]]

>>> entities
{(3, 2): 1}
>>> player_position
(1, 1)

5.4 SokobanModel CourseNana.COM

The SokobanModel class is responsible for maintaining the game state, and applying game logic. The SokobanModel class must implement the following methods. Note, however, that some of these methods will become very long. You will likely benefit from adding extra helper methods to this class to help break up some of these long methods. CourseNana.COM

__init__(self, maze_file: str) -> None (method) This method should read the given maze file (see a2_support.py), call the convert_maze function to get CourseNana.COM

representations for the maze, non-player entities, and player position, and construct a player instance with the 8 CourseNana.COM

player stats described in the maze file. CourseNana.COM

You may assume we will not test your code with invalid maze files. You may also assume that the maze file will not contain any goals that are already filled. CourseNana.COM

 get_maze(self) -> Grid

Returns the maze representation (list of lists of Tile instances). CourseNana.COM

 get_entities(self) -> Entities

Returns the dicitonary mapping positions to non-player entities. CourseNana.COM

 get_player_position(self) -> tuple[int, int]

Returns the player’s current position. CourseNana.COM

 get_player_moves_remaining(self) -> int:

Returns the number of moves the player has remaining. CourseNana.COM

 get_player_strength(self) -> int:

Returns the player’s current strength. CourseNana.COM

 attempt_move(self, direction: str) -> bool:

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

(method) CourseNana.COM

This method should handle trying to move the player in the given direction and any flow on effects from that move. The method should return True if a move occurred successfully, and False otherwise. The steps you must handle in this method are as follows: CourseNana.COM

  1. If the direction is not a valid move direction, or the new position would be out of bounds or blocked by a blocking tile, then return False. CourseNana.COM

  2. If the move would cause the player to move to a position containing a crate, attempt to move the crate in the given ‘direction’. If the crate cannot be moved then return False and do not move the player. If the crate is moved onto an unfilled goal tile, remove the crate from the maze and update that goal tile to be filled. A crate cannot be moved if either of the following cases occur: CourseNana.COM

    The player’s strength is less than the strength required to push the crate. CourseNana.COM

    The position on which the crate would move is not in bounds, or contains a blocking tile or any entity. CourseNana.COM

  3. If the move would cause the player to move to a position containing a potion, remove that potion from the maze and apply its effects to the player. CourseNana.COM

  4. If the move is valid according to all earlier steps, update the player’s position and decrease their moves remaining by 1. Then return True to indicate that the move was a success. CourseNana.COM

has_won(self) -> bool: (method) Returns True only when the game has been won. The game has been won if all goals are filled, or equivalently CourseNana.COM

(since the number of goals is always equal to the number of crates), there are no more crates on the grid. CourseNana.COM

Examples CourseNana.COM

>>> model = SokobanModel('maze_files/maze1.txt')
>>> model.get_maze()
[[W,W,W,W,W,W,W,W],[W,,,,W,, ,W],[W,, , ,W, , ,W], [W, , , , W, G, , W], [W, , , , , , , W], [W, , , , , , , W], [W, W, W, W, W, W, W, W]]

>>> model.get_entities()
{(3, 2): 1}
>>> model.get_player_position()
(1, 1)
>>> model.get_player_moves_remaining()
>>> model.get_player_strength()
>>> model.has_won()
>>> model.attempt_move('s')
>>> model.get_player_moves_remaining()
>>> model.get_player_position()
(2, 1)
>>> model.attempt_move('a')
>>> model.attempt_move('s')
>>> model.attempt_move('d')
>>> model.get_player_position()
(3, 2)
>>> model.get_entities()
{(3, 3): 1}

5.5 Controller CourseNana.COM

The Sokoban class represents the controller class in the MVC structure. It is responsible for instantiating the model class (that you just wrote) and the view class (which is provided in a2_support.py). The controller class handles events (such as user input) and facilitates communication between the model and view classes. The Sokoban class must implement the following methods. CourseNana.COM

__init__(self, maze_file: str) -> None: (method) This method should construct an instance of the SokobanModel class using the provided maze_file, as well as CourseNana.COM

an instance of the SokobanView class.
display(self) -> None: (method) CourseNana.COM

This method should call the display_game and display_stats methods on the instance of the SokobanView class. The arguments given should be based on the state of the game as defined by the SokobanModel instance. CourseNana.COM

play_game(self) -> None: (method) This method runs the main game loop, and should implement the following behaviour: CourseNana.COM

While the game is still going (i.e. the function has not returned), repeat the following procedure: 1. If the game has been won, display the game state and the message ‘You won!’, and return. 2. If the game has been lost, display the message ‘You lost!’, and return.
3. Display the current game state.

4. Prompt the user for a move with the prompt ‘Enter move: ’. CourseNana.COM

5. If the move is ‘q’, return, otherwise tell the model to attempt the given move. CourseNana.COM

6. If the move was invalid, display the message ‘Invalid move\n’. CourseNana.COM

5.6 CSSE7030 Task: Undo command CourseNana.COM

Students enrolled in CSSE7030 must also implement support for an undo command. Students enrolled in CSSE1001 do not need to attempt this task to earn full marks, and cannot earn extra marks for attempting this task. CourseNana.COM

When the user enters the command ‘u’ at the prompt for a move, rather than considering it an invalid move your program should reverse the last valid move made and continue on with gameplay. In order to achieve this task, you will need to add the following methods: CourseNana.COM

Goal.unfill(self) -> None: create a method which sets a goal to be unfilled.
SokobanModel.undo(self) -> None: create a method in the model which reverses the effects of the last CourseNana.COM

valid move.
You will also need to make changes to the following methods:

Controller.play_game: add support for handling the input ‘u’ appropriately. In the flow of logic described in section 5.5 for this method, support for ‘u’ input would be at the beginning of step 5. CourseNana.COM

You may assume your program will only be tested with one undo at a time. That is, you may assume the user will not enter ‘u’ and then immediately enter ‘u’ again without entering a valid move in between. If the user enters ‘u’ after an invalid move, you should reverse the last valid move; that is, the last move that had any effect. You may not assume that the user will only enter ‘u’ once per game. CourseNana.COM

6 Assessment and Marking Criteria CourseNana.COM

This assignment assesses course learning objectives:
1. apply program constructs such as variables, selection, iteration and sub-routines,
2. apply basic object-oriented concepts such as classes, instances and methods,
3. read and analyse code written by others,
4. analyse a problem and design an algorithmic solution to the problem,
5. read and analyse a design and be able to translate the design into a working program, and 6. apply techniques for testing and debugging.

6.1 Marking Breakdown CourseNana.COM

Your total grade for this assessment piece will be a combination of your functionality and style marks. For this assignment, functionality and style have equal weighting, meaning you should be devoting at least as much time towards proper styling of your code as you do trying to make it functional. CourseNana.COM

6.2 Functionality Marking CourseNana.COM

Your program’s functionality will be marked out of a total of 6 marks. As in assignment 1, your assignment will be put through a series of tests and your functionality mark will be proportional to the number of tests you pass. You will be given a subset of the functionality tests before the due date for the assignment. You may receive partial marks within each class for partially working methods, or for implementing only a few classes. Note that you do not need to implement the model and controller classes in order to earn a passing grade for this assignment, provided that your attempts at earlier sections of the assignment are functional, well-designed, and well-styled. CourseNana.COM

You need to perform your own testing of your program to make sure that it meets all specifications given in the assignment. Only relying on the provided tests is likely to result in your program failing in some cases and you losing some functionality marks. Note: Functionality tests are automated, so outputs need to match exactly what is expected. CourseNana.COM

Your program must run in the Python interpreter (the IDLE environment). Partial solutions will be marked, but if there are errors in your code that cause the interpreter to fail to execute your program, you will get zero for functionality marks. If there is a part of your code that causes the interpreter to fail, comment out the code so that the remainder can run. Your program must run using the Python 3.11 interpreter. If it runs in another environment (e.g. Python 3.10 or PyCharm) but not in the Python 3.11 interpreter, you will get zero for the functionality mark. CourseNana.COM

If your program cannot not run on Gradescope, you will receive no marks for functionality. It is your responsibility to upload to Gradescope in time to debug any issues that may cause Gradescope to be unable to CourseNana.COM

run your submission. Tutors will not fix any aspect of your code (including file names). CourseNana.COM

6.3 Style Marking CourseNana.COM

The style of your assignment will be assessed by a tutor. The style mark will be out of 4 marks. The key consideration in marking your code style is whether the code is easy to understand and demonstrates understanding of object-oriented programming concepts. In this assignment, your code style will be assessed against the following criteria. CourseNana.COM

Readability CourseNana.COM

  • –  Program Structure: Layout of code makes it easier to read and follow its logic. This includes using whitespace to highlight blocks of logic. CourseNana.COM

  • –  Descriptive Identifier Names: Variable, constant, function, class and method names clearly describe what they represent in the program’s logic. Do not use what is called the Hungarian Notation for identifiers. In short, this means do not include the identifier’s type in its name (e.g. item_list), rather make the name meaningful. (e.g. Use items, where plural informs the reader it is a collection of items and it can easily be changed to be some other collection and not a list.) The main reason for this restriction is that most people who follow the Hungarian Notation convention, use it poorly (including Microsoft). CourseNana.COM

  • –  Named Constants: All non-trivial fixed values (literal constants) in the code are represented by descriptive named (symbolic) constants. CourseNana.COM

    Documentation CourseNana.COM

  • –  Comment Clarity: Comments provide meaningful descriptions of the code. They should not repeat what is already obvious by reading the code (e.g. # Setting variable to 0.). Comments should not be verbose or excessive, as this can make it difficult to follow the code. CourseNana.COM

  • –  Informative Docstrings: Every class, method and function should have a docstring that summarises its purpose. This includes describing parameters and return values so that others can understand how to use the method or function correctly. CourseNana.COM

  • –  Description of Logic: All significant blocks of code should have a comment to explain how the logic works. For a small method or function, the logic should usually be clear from the code and docstring. For long or complex methods or functions, each logical block should have an in-line comment describing its logic. CourseNana.COM

    Structure will be assessed as to how well your code design conforms to good object-oriented programming practices. CourseNana.COM

    Object-Oriented Program Structure CourseNana.COM

    • –  Classes & Instances: Objects are used as entities to which messages are sent, demonstrating understanding of the differences between classes and instances. CourseNana.COM

    • –  Encapsulation: Classes are designed as independent modules with state and behaviour. Methods only directly access the state of the object on which they were invoked. Methods never update the state of another object. CourseNana.COM

    • –  Inheritance & Polymorphism: Subclasses are designed as specialised versions of their superclasses. Subclasses extend the behaviour of their superclass without re-implementing behaviour, or breaking the superclass behaviour or design. Subclasses redefine behaviour of appropriate methods to extend the superclasses’ type. Subclasses do not break their superclass’ interface. CourseNana.COM

    • –  Model View Controller: Your program adheres to the Apple MVC structure. Algorithmic Logic CourseNana.COM

    • –  Single Instance of Logic: Blocks of code should not be duplicated in your program. Any code that needs to be used multiple times should be implemented as a method or function. CourseNana.COM

    • –  Variable Scope: Variables should be declared locally in the method or function in which they are 12 CourseNana.COM


needed. Attributes should be declared clearly within the __init__ method. Class variables are avoided, except where they simplify program logic. Global variables should not be used. CourseNana.COM

Control Structures: Logic is structured simply and clearly through good use of control structures (e.g. loops and conditional statements). CourseNana.COM

6.4 Documentation Requirements CourseNana.COM

There are a significant number of classes and contained methods you have to implement for this assignment. For each one, you must provide documentation in the form of a docstring. The only exception is for overridden methods on subclasses, as python docstrings are inherited. CourseNana.COM

6.5 Assignment Submission CourseNana.COM

This assignment follows the same assignment submission policy as assignment 1. Please refer to the assignment 1 task sheet. You must submit your assignment as a single Python file called a2.py (use this name – all lower case), and nothing else. Your submission will be automatically run to determine the functionality mark. If you submit a file with a different name, the tests will fail and you will get zero for functionality. Do not submit the a2_support.py file, or any other files. Do not submit any sort of archive file (e.g. zip, rar, 7z, etc.). CourseNana.COM

6.6 Plagiarism CourseNana.COM

This assignment follows the same plagiarism policy as assignment 1. Please refer to the assignment 1 task sheet. CourseNana.COM

Get in Touch with Our Experts

Wechat WeChat
Whatsapp Whatsapp
UQ代写,CSSE1001代写,CSSE7030代写,Introduction to Software Engineering代写,Python代写,Fancy Sokoban代写,UQ代编,CSSE1001代编,CSSE7030代编,Introduction to Software Engineering代编,Python代编,Fancy Sokoban代编,UQ代考,CSSE1001代考,CSSE7030代考,Introduction to Software Engineering代考,Python代考,Fancy Sokoban代考,UQhelp,CSSE1001help,CSSE7030help,Introduction to Software Engineeringhelp,Pythonhelp,Fancy Sokobanhelp,UQ作业代写,CSSE1001作业代写,CSSE7030作业代写,Introduction to Software Engineering作业代写,Python作业代写,Fancy Sokoban作业代写,UQ编程代写,CSSE1001编程代写,CSSE7030编程代写,Introduction to Software Engineering编程代写,Python编程代写,Fancy Sokoban编程代写,UQprogramming help,CSSE1001programming help,CSSE7030programming help,Introduction to Software Engineeringprogramming help,Pythonprogramming help,Fancy Sokobanprogramming help,UQassignment help,CSSE1001assignment help,CSSE7030assignment help,Introduction to Software Engineeringassignment help,Pythonassignment help,Fancy Sokobanassignment help,UQsolution,CSSE1001solution,CSSE7030solution,Introduction to Software Engineeringsolution,Pythonsolution,Fancy Sokobansolution,