Options
All
  • Public
  • Public/Protected
  • All
Menu

room-finder - v0.4.3

Index

Type aliases

ConnectorNode

ConnectorNode<ForkName, StairName>: StairNode<StairName> | ForkNode<ForkName>

Type parameters

  • ForkName: string

  • StairName: string

HallConnectorsStructures

HallConnectorsStructures<ForkName, StairName>: { nodes: { edgeLengthFromPreviousNodeInHallway: number; nodeId: Node<ForkName, StairName> }[]; oneWay: OneWay }[]

Type parameters

  • ForkName: string

  • StairName: string

Node

Node<ForkName, StairName>: StairNode<StairName> | ForkNode<ForkName> | BasicRoomNode

Type parameters

  • ForkName: string

  • StairName: string

OneWay

OneWay: "forward" | "backward" | false

StairOneWay

StairOneWay: false | "up" | "down"

Functions

assertValidBuilding

  • assertValidBuilding<ForkName, StairName>(b: Building<ForkName, StairName>): void
  • Type parameters

    • ForkName: string

    • StairName: string

    Parameters

    Returns void

dirToString

  • Parameters

    • dir: Direction

      A direction (LEFT,RIGHT,FRONT)

    Returns string

    "left", "right", "front", or "back"

dirToTurnString

  • Parameters

    • dir: Direction

      A direction (LEFT,RIGHT,FRONT)

    Returns string

    "Go straight", "Turn left", or "Turn right"

isConnectorNode

  • isConnectorNode<ForkName, StairName>(node: Node<ForkName, StairName> | undefined): node is ConnectorNode<ForkName, StairName>
  • Type parameters

    • ForkName: string

    • StairName: string

    Parameters

    • node: Node<ForkName, StairName> | undefined

    Returns node is ConnectorNode<ForkName, StairName>

isLeftOrRight

  • Parameters

    Returns boolean

isValidBuilding

  • isValidBuilding<ForkName, StairName>(b: Building<ForkName, StairName>): { connectedSections: string[][]; valid: true } | { connectedSections: string[][]; reason: string; valid: false }
  • building.validity.valid is true if the building passes a few validity tests. This is useful for testing.

    There are several reasons that it could be false:

    1. There's more than one room with the same name.
    2. There's at least one hallway that doesn't have any nodes (Forks or Stairs) to connect it to the rest of the building.
    3. The graph isn't connected (connectedSections > 1). That means there's a group of at least one node that isn't connected to the rest of the graph.
    4. There are negative edge weights in the graph.

    If building.validity.valid is false, building.validity.reason gives the reason why it's invalid.

    connectedSections is a string[][], where each string[] is a list of nodes that are all connected. (Each string[] forms a connected graph.) This is useful for debugging to figure out which nodes aren't connected to the rest of the graph.

    Type parameters

    • ForkName: string

    • StairName: string

    Parameters

    Returns { connectedSections: string[][]; valid: true } | { connectedSections: string[][]; reason: string; valid: false }

nodeToHumanString

  • nodeToHumanString<ForkName, StairName>(node: Node<ForkName, StairName>): string
  • Type parameters

    • ForkName: string

    • StairName: string

    Parameters

    • node: Node<ForkName, StairName>

    Returns string

onFloor

  • onFloor<StairName>(name: StairName, floor: number): StairNode<StairName>
  • Type parameters

    • StairName: string

    Parameters

    • name: StairName

      The name of the staircase

    • floor: number

      The floor that this node is on

    Returns StairNode<StairName>

    A StairNode with the given name on the given floor

reverseConnection

  • reverseConnection<ForkName>(node: ForkName | ForkNode<ForkName>): ForkNode<ForkName>
  • Type parameters

    • ForkName: string

    Parameters

    • node: ForkName | ForkNode<ForkName>

      Either a string or a ForkNode

    Returns ForkNode<ForkName>

    a reversed version of the provided ForkNode

Generated using TypeDoc