Skip to content

Loop #1

@BartAdv

Description

@BartAdv

Seems to be really hard for me to nail it down.

Steps

This commit should make it easy to build and repro it:

5696a74

stack build && stack exec -- hackslash

Once it starts (it shows an empty window):

hit 'S'

watch the output with fine loop.

What I know about it

Basically, the goal was to write simple 'monster' that would react to change in monster positions, finding nearest one, and approaching it. This happens here:

      cmdApproach = traceEvent "cmdApproach" $
                    let eTarget = traceEvent "eTarget" $ fromJust <$> ffilter isJust (uncurry findTarget <$> attachPromptlyDyn pos (updated inputPositions))
                        ePath = init . fromJust <$> traceEvent "ePath" (ffilter isJust (uncurry (findPath inputLevel) <$> attachPromptlyDyn pos eTarget))
                    in CmdWalk <$> ePath
pos :: Dynamic t Coord -- monster position
inputPositions :: Dynamic t (Map MonsterID Coord) -- all monster positions
  • findTarget does not find itself
  • findPath uses astar library, currently whole grid is passable (I've stripped the code of freeablo dependencies)
  • for some short paths, it doesn't loop.
  • By looking at trace output, it doesn't look to me like it is the findPath which loops endlessly, so my hunch is that it could be some causality loop?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions