bothack.pathing
->Path
(->Path step path target)
Positional factory function for class bothack.pathing.Path.
at-level?
(at-level? game level)
autonavigable?
(autonavigable? game level opts [from to])
base-cost
(base-cost level dir tile opts)
branch-map
(branch-map game)
{ dlvl of entrance in :main => :branch } for 'standard' branches
can-unlock?
(can-unlock? game)
dare-destroy?
(dare-destroy? level tile)
dead-end?
(dead-end? level tile)
entering-shop?
(entering-shop? game)
exploration-index
(exploration-index game)
(exploration-index game branch tag-or-dlvl)
Measures how much the level was explored/searched. Zero means obviously not
fully explored, larger number means more searching was done.
explore
(explore game)
(explore game branch)
(explore game branch tag-or-dlvl)
(explore game branch tag-or-dlvl exclusive?)
explore-level
(explore-level game branch tag-or-dlvl)
explored?
(explored? game)
(explored? game branch)
(explored? game branch tag-or-dlvl)
fidget
(fidget game)
(fidget game level)
(fidget {:keys [player], :as game} level target)
Move around randomly or wait to make a peaceful move out of the way
go-down
(go-down game level)
Go through a hole or trapdoor or dig down if possible
level-seq
(level-seq game)
(level-seq game opts)
Lazy seq of levels by unit distance from current (doesn't consider level layouts)
likely-walkable?
(likely-walkable? level tile)
Less optimistic about unexplored tiles than walkable?, but still returns
true for item in an (unknown) wall.
map->Path
(map->Path m__5869__auto__)
Factory function for class bothack.pathing.Path, taking a map of keywords to field values.
move
(move game level from to)
(move game level from to opts)
Returns [cost Action] for a move, if it is possible
nav-targets
(nav-targets coll)
navigate
(navigate game pos-or-goal-fn)
(navigate {:keys [player], :as game} pos-or-goal-fn {:keys [max-steps walking adjacent no-dig no-levitation], :as opts})
Return shortest Path for given target position or predicate (a set of
positions or any fn that takes a tile and returns boolean), will use A* or
Dijkstra's algorithm as appropriate.
Supported options (a map or a set if all vals of the map would be true):
:walking - don't use actions except Move (no door opening etc.)
:adjacent - path to closest adjacent tile instead of the target directly
:explored - don't path through unknown tiles
:max-steps <num> - don't navigate further than given number of steps
:no-traps - more trap avoidance
:no-dig - don't use the pickaxe or mattock
:no-kick - don't kick down doors
:no-levitation - when navigating deliberately into a hole/trapdoor
:prefer-items - walk over unknown items preferably (useful for exploration but possibly dangerous when low on health - items could be corpses on a dangerous trap)
:no-autonav - don't use _ autotravel (when fighting monsters)
:no-fight - don't path through hostile monsters
navopts
(navopts s)
(navopts s steps)
needs-levi?
(needs-levi? tile)
pass-monster
(pass-monster game level to-tile dir monster opts)
reset-exploration
(reset-exploration bh)
Performance optimization - to know if the level is explored or not we need
to run expensive navigation, might as well cache the result
safe-from-guards?
(safe-from-guards? level)
Only just enough to handle the most usual corner-case where the only door in
the stair-room of minetown is locked. Potentially dangerous without
infravision.
safely-walkable?
(safely-walkable? level tile)
search-level
(search-level game)
(search-level game max-iter)
seek
(seek game smth)
(seek game smth opts)
Like explore but also searches and always tries to return an action until
the target is found
options: same as navigate and the following:
:no-explore - directly skips to searching
seek-branch
(seek-branch game new-branch-id)
seek-feature
(seek-feature game feature)
seek-level
(seek-level game new-branch-id tag-or-dlvl)
Navigate to a branch or dlvl/tagged level within one, neither needs to be
found previously.
seek-portal
(seek-portal game)
seek-tile
(seek-tile game goal?)
(seek-tile game goal? opts)
Options:
:up - only go up, never to subbranches
:max-delta - limit search depth
unexplored-column
(unexplored-column game level)
Look for a column of unexplored tiles on segments of the screen.
unexplored-columns
(unexplored-columns game level)
visit
(visit game branch)
(visit game branch tag-or-level)
visited?
(visited? game branch)
(visited? game branch dlvl-or-tag)