Module AFTN.Map

Map parsing and utilities

type room = {
  1. name : string;
    (*

    Name of this room. If None, this room is a corridor

    *)
  2. is_corridor : bool;
    (*

    If the room is a corridor

    *)
  3. connections : string list;
    (*

    Connections denoted by room names - required as opposed to room list due to functional update of map

    *)
  4. ladder_connection : string option;
    (*

    Room connected by a ladder

    *)
}
val string_of_room : room -> string

Get string representation of room

val blank_room : room
val new_room : string -> room

Create new non-corridor room

type map = {
  1. map_name : string;
  2. rooms : room list;
  3. player_start_room : room;
  4. xeno_start_room : room;
  5. ash_start_room : room;
  6. scrap_rooms : room list;
  7. event_rooms : room list;
  8. coolant_rooms : room list;
  9. ascii_map : string option;
}
val find_room_opt : map -> string -> room option
val find_room : map -> string -> room
val map_file_of_map : map -> string

Get a string representation of a map that is equivalent to the input map file

val update_map_room : map -> room -> room -> map
val blank_map : map
type map_parsing_state =
  1. | MapName
  2. | RoomNames
  3. | NumCorridors
  4. | RoomConnections
  5. | Ladders
  6. | ScrapRooms
  7. | EventRooms
  8. | CoolantRooms
  9. | AsciiMap

Determines which phase of map file parsing is ongoing

val string_of_parsing_state : map_parsing_state -> string
val advance_parsing_state : map_parsing_state option -> map_parsing_state option

Step parsing state forward

val parse_map_file : string -> map

Read a map file and parse it into a map

type search_params = {
  1. distance : string -> int;
  2. discovered : string -> bool;
  3. previous_room : string -> string;
}

Map room names to corresponding search parameters

val active_search_params : search_params Stdlib.ref
val set_room_distance : room -> int -> unit
val discover_room : room -> unit
val set_previous_room : room -> room -> unit
val shortest_path : map -> room -> room -> room list

Find the shortest path in m from source to dest

val find_rooms_by_distance : map -> room -> int -> room list

Find rooms in m that are exactly distance steps away from root

val find_rooms_within_distance : map -> room -> int -> room list