I got it working after a bit of back-and-forth. I had to upgrade to the latest 
version of [astar](https://github.com/Nycto/AStarNim) (with nimble install 
'astar@#head'), and move the 'Bot' concept to an object that StatelessBot 
inherited from (and moved the decide proc into a closure). Couldn't keep as 
top-level, since closure calling convention not allowed for top-level procs.
    
    
    let nymph = StatelessBot(
          name: "Nymph",
          key: readFile("nymph.key"),
          decide: (proc(m: Map): Dir {.closure, locks:0.}=
            let me = m.hero
            
            let tgt = find_nearest[Hero](m, me.pos, m.heroes, proc(h:Hero): 
bool = me.id != h.id )
            
            let path = astar_path(m, m.hero.pos, tgt.pos)
            let d = getDir(m.hero.pos, path[0])
            echo format("Chasing $1; Moving $2", tgt.id, d)
            result = d
            
            proc printer(pos:Pos, t:Tile): string =
              result = printTile(t)
              if t == tEmpty:
                for i,p in path:
                  if p == pos:
                    result = $(i+1)
                    break
            
            Print(m.grid,printer)
          )
    )
    

In debugging, I found that nim c --reportConceptFailures:on gets squirrelly 
when you have something that uses 'when compiles(foo)' and foo doesn't compile, 
but I need to see if I can get a clean way of reproducing that before 
submitting an issue. There might be a way to keep Bot as a concept, but I'd 
have to play with it more.

Reply via email to