Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GridPoint class #42

Open
tmcclintock opened this issue Jan 2, 2021 · 0 comments
Open

GridPoint class #42

tmcclintock opened this issue Jan 2, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@tmcclintock
Copy link
Owner

We have the Cell and Edges and the next fundamental class we should implement is the GridPoint (other names include Intersection or idk). The GridPoint represents the location where Edges meet. The would be useful for a few reasons:

  • provide another location to fix objects, once we get to populating the dungeons
  • can make exporting easier if we want to draw walls/boundaries from the corners of Cells or boundaries that cut through Cells

It should be developed just like the Edge class. It should be defined in a grid_point.py file. A spec would be:

# grid_point.py

class GridPoint:

    def __init__(self, edges: Optional[List[Edge]]):
        self._edges = edges or []

    @property
    def edges(self):
        return self._edges

    def set_edges(edges: List[Edge]):
        self._edges = edges

And it should only be instantiated from within the Grid class:

# grid.py

class Grid:

    def __init__(self, ...):
        ...
        self.link_edges_to_grid_points()

    def link_edges_to_grid_points(self):
        # connect the edges to the grid_points and vice versa

The Edge class should get pointers to the GridPoints as well.

@tmcclintock tmcclintock added enhancement New feature or request good first issue Good for newcomers labels Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant