Skip to content

Cleaning up the implementation code in Implementation/simulate.py #3

@jcal13

Description

@jcal13

Short list of things to be cleaned up in this file. As discussed previously, keeping in some of these things and addressing them in the readme would also be good... perhaps having two (or more) versions of the file could be worth considering, like a "starter" file and a "solution" file or similar.

  • updating the docstring formatting to be fully consistent with CSC148 (rough example below for the Particle class):
class Particle:
    """
    An abstract class representing a particle.

    Attributes:
    - id: unique ID
    - x: x-coordinate
    - y: y-coordinate
    - radius: radius
    - colour: colour
    - shape: shape

    Representation Invariants:
    - self.x >= 0
    - self.y >= 0
    - self.radius > 0
    - self.shape in {'circle', 'square'}

    """
    id: int
    x: float
    y: float
    radius: int
    colour: tuple[int, int, int]
    shape: str
  • running python TA and fixing all style issues, such as ones mentioned below:
    • adding type annotations to all functions and methods; for tuple, make sure to specify the types the tuple contains (e.g., tuple[float, float] for coordinates... or using int if in units of pixels).

    • adding docstrings to all functions and methods, with docstring examples as appropriate.

    • naming conventions with pothole case used for method names and CamelCase for class names.

    • 80 character line length max.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions