Add a bunch of doc strings and header comments to files

This commit is contained in:
Eryn Wells 2023-02-15 08:25:40 -08:00
parent 633580e27a
commit 4050ac5c6f
7 changed files with 25 additions and 3 deletions

View file

@ -64,7 +64,7 @@ class BumpAction(MoveAction):
Attributes Attributes
---------- ----------
direction : Direction direction : Vector
The direction to test The direction to test
''' '''

View file

@ -1,5 +1,9 @@
# Eryn Wells <eryn@erynwells.me> # Eryn Wells <eryn@erynwells.me>
'''
The game's graphical user interface
'''
from typing import List from typing import List
from tcod.console import Console from tcod.console import Console

View file

@ -82,6 +82,7 @@ class Map:
return self.tile_is_in_bounds(point) and self.tiles[point.x, point.y]['walkable'] return self.tile_is_in_bounds(point) and self.tiles[point.x, point.y]['walkable']
def point_is_explored(self, point: Point) -> bool: 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] return self.tile_is_in_bounds(point) and self.explored[point.x, point.y]
def highlight_points(self, points: Iterable[Point]): def highlight_points(self, points: Iterable[Point]):

View file

@ -12,13 +12,16 @@ class MapGenerator:
@property @property
def up_stairs(self) -> List[Point]: def up_stairs(self) -> List[Point]:
'''The location of any routes to a higher floor of the dungeon.'''
raise NotImplementedError() raise NotImplementedError()
@property @property
def down_stairs(self) -> List[Point]: def down_stairs(self) -> List[Point]:
'''The location of any routes to a lower floor of the dungeon.'''
raise NotImplementedError() raise NotImplementedError()
def generate(self, tiles: np.ndarray): def generate(self, tiles: np.ndarray):
'''Generate a map and place it in `tiles`'''
raise NotImplementedError() raise NotImplementedError()

View file

@ -1,3 +1,5 @@
# Eryn Wells <eryn@erynwells.me>
''' '''
Defines an abstract CorridorGenerator and several concrete subclasses. These classes generate corridors between rooms. Defines an abstract CorridorGenerator and several concrete subclasses. These classes generate corridors between rooms.
''' '''

View file

@ -1,6 +1,9 @@
from typing import Iterator # Eryn Wells <eryn@erynwels.me>
'''
Implements an abstract Room class, and subclasses that implement it. Rooms are basic components of maps.
'''
from ..geometry import Point, Rect
class Room: class Room:

View file

@ -1,3 +1,12 @@
# Eryn Wells <eryn@erynwells.me>
'''
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 from typing import Tuple
import numpy as np import numpy as np