try to force the bridge command to give less deterministic results

This commit is contained in:
skkiesel 2017-06-07 20:07:26 -04:00
parent bd7cf6be7c
commit 11c4f78bbd
1 changed files with 5 additions and 2 deletions

View File

@ -862,7 +862,7 @@ func (p *BabblerPlugin) babbleSeedBookends(babblerName string, start, end []stri
closed := map[int64]*searchNode{ startWordNode.NodeId : open[0] } closed := map[int64]*searchNode{ startWordNode.NodeId : open[0] }
goalNodeId := int64(-1) goalNodeId := int64(-1)
for i := 0; i < len(open) && i < 250; i++ { for i := 0; i < len(open) && i < 1000; i++ {
cur := open[i] cur := open[i]
arcs, err := p.getNextArcs(cur.babblerNodeId) arcs, err := p.getNextArcs(cur.babblerNodeId)
@ -880,11 +880,14 @@ func (p *BabblerPlugin) babbleSeedBookends(babblerName string, start, end []stri
if arc.ToNodeId == endWordNode.NodeId { if arc.ToNodeId == endWordNode.NodeId {
goalNodeId = cur.babblerNodeId goalNodeId = cur.babblerNodeId
//add a little randomization in through maybe searching beyond this solution?
if rand.Intn(4) == 0 {
break break
} }
} }
} }
} }
}
if goalNodeId == -1 { if goalNodeId == -1 {
return "", errors.New("couldn't find path") return "", errors.New("couldn't find path")