From 4050ac5c6f9310943f2595af3772d586fd0659a9 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 15 Feb 2023 08:25:40 -0800 Subject: [PATCH] Add a bunch of doc strings and header comments to files --- erynrl/actions/game.py | 2 +- erynrl/interface/__init__.py | 4 ++++ erynrl/map/__init__.py | 1 + erynrl/map/generator/__init__.py | 3 +++ erynrl/map/generator/corridor.py | 2 ++ erynrl/map/room.py | 7 +++++-- erynrl/map/tile.py | 9 +++++++++ 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/erynrl/actions/game.py b/erynrl/actions/game.py index 0e70fbd..e793005 100644 --- a/erynrl/actions/game.py +++ b/erynrl/actions/game.py @@ -64,7 +64,7 @@ class BumpAction(MoveAction): Attributes ---------- - direction : Direction + direction : Vector The direction to test ''' diff --git a/erynrl/interface/__init__.py b/erynrl/interface/__init__.py index b8f06d3..bf33a73 100644 --- a/erynrl/interface/__init__.py +++ b/erynrl/interface/__init__.py @@ -1,5 +1,9 @@ # Eryn Wells +''' +The game's graphical user interface +''' + from typing import List from tcod.console import Console diff --git a/erynrl/map/__init__.py b/erynrl/map/__init__.py index 589c47a..cb07b1f 100644 --- a/erynrl/map/__init__.py +++ b/erynrl/map/__init__.py @@ -82,6 +82,7 @@ class Map: return self.tile_is_in_bounds(point) and self.tiles[point.x, point.y]['walkable'] def point_is_explored(self, point: Point) -> bool: + '''Return True if the tile at the given point has been explored by the player''' return self.tile_is_in_bounds(point) and self.explored[point.x, point.y] def highlight_points(self, points: Iterable[Point]): diff --git a/erynrl/map/generator/__init__.py b/erynrl/map/generator/__init__.py index 2d4e361..dc11b4b 100644 --- a/erynrl/map/generator/__init__.py +++ b/erynrl/map/generator/__init__.py @@ -12,13 +12,16 @@ class MapGenerator: @property def up_stairs(self) -> List[Point]: + '''The location of any routes to a higher floor of the dungeon.''' raise NotImplementedError() @property def down_stairs(self) -> List[Point]: + '''The location of any routes to a lower floor of the dungeon.''' raise NotImplementedError() def generate(self, tiles: np.ndarray): + '''Generate a map and place it in `tiles`''' raise NotImplementedError() diff --git a/erynrl/map/generator/corridor.py b/erynrl/map/generator/corridor.py index c61b273..aa93b9d 100644 --- a/erynrl/map/generator/corridor.py +++ b/erynrl/map/generator/corridor.py @@ -1,3 +1,5 @@ +# Eryn Wells + ''' Defines an abstract CorridorGenerator and several concrete subclasses. These classes generate corridors between rooms. ''' diff --git a/erynrl/map/room.py b/erynrl/map/room.py index 9a2e68d..3651d6a 100644 --- a/erynrl/map/room.py +++ b/erynrl/map/room.py @@ -1,6 +1,9 @@ -from typing import Iterator +# Eryn Wells + +''' +Implements an abstract Room class, and subclasses that implement it. Rooms are basic components of maps. +''' -from ..geometry import Point, Rect class Room: diff --git a/erynrl/map/tile.py b/erynrl/map/tile.py index d869920..91d29ca 100644 --- a/erynrl/map/tile.py +++ b/erynrl/map/tile.py @@ -1,3 +1,12 @@ +# Eryn Wells + +''' +Map tiles and tile related things. + +Maps are represented with 2-dimensional numpy arrays with the `dtype`s defined +here. Tiles are instances of those dtypes. +''' + from typing import Tuple import numpy as np