You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While defined as func Path(from, to Pather) ..., the resulting path actually starts at to node and ends at from.
This can be seen using this patch to pather_test.go:
diff --git pather_test.go pather_test.go
index b9d78bd..331ee0d 100644
--- pather_test.go+++ pather_test.go@@ -159,18 +159,19 @@ func (w World) RenderPath(path []Pather) string {
return ""
}
height := len(w[0])
- pathLocs := map[string]bool{}- for _, p := range path {+ pathLocs := map[string]rune{}+ for i, p := range path {
pT := p.(*Tile)
- pathLocs[fmt.Sprintf("%d,%d", pT.X, pT.Y)] = true+ nr := []rune("0123456789abc")[i%12] // "clever" rendering of node index in path.+ pathLocs[fmt.Sprintf("%d,%d", pT.X, pT.Y)] = nr
}
rows := make([]string, height)
for x := 0; x < width; x++ {
for y := 0; y < height; y++ {
t := w.Tile(x, y)
r := ' '
- if pathLocs[fmt.Sprintf("%d,%d", x, y)] {- r = KindRunes[KindPath]+ if nr := pathLocs[fmt.Sprintf("%d,%d", x, y)]; nr != 0 {+ r = nr
} else if t != nil {
r = KindRunes[t.Kind]
}
Hi @avivey, thanks for the issue and the investigation. This could potentially be a breaking change for users, so will have to be fixed in a major version.
While defined as
func Path(from, to Pather) ...
, the resulting path actually starts atto
node and ends atfrom
.This can be seen using this patch to
pather_test.go
:which renders
0
onT
and9
onF
:The text was updated successfully, but these errors were encountered: