renamed to randomDirection to reflect what function does

This commit is contained in:
Stephen McQuay 2014-01-12 01:27:12 -08:00
parent 4d0eac703c
commit 5b438b7ffe

View File

@ -196,7 +196,7 @@ func (r *robot) recon() {
}
}
func (r *robot) selectDirection() *govector.Point2d {
func (r *robot) randomDirection() *govector.Point2d {
p := govector.Vector2d{
X: rand.Float32() * r.game.BoardSize.Width,
Y: rand.Float32() * r.game.BoardSize.Height,
@ -223,14 +223,14 @@ func (r *robot) navigate() {
if r.boardstate.Reset {
// XXX We actually *want* to get here, but never do ..
panic("reset")
r.moveto = r.selectDirection()
r.moveto = r.randomDirection()
}
if r.moveto == nil {
if *verbose {
log.Printf("%s: nil", r.name)
}
r.moveto = r.selectDirection()
r.moveto = r.randomDirection()
}
togo := r.me.Position.Sub(*r.moveto).Mag()
@ -238,7 +238,7 @@ func (r *robot) navigate() {
if *verbose {
log.Printf("%s got to destination", r.name)
}
r.moveto = r.selectDirection()
r.moveto = r.randomDirection()
return
}
if !r.probe(r.me.Position.Add(r.me.Heading.Scale(safeDistance))) {
@ -250,7 +250,7 @@ func (r *robot) navigate() {
if *verbose {
log.Printf("%s unsafe to move, choose new direction", r.name)
}
r.moveto = r.selectDirection()
r.moveto = r.randomDirection()
return
}
}
@ -259,7 +259,7 @@ func (r *robot) navigate() {
if *verbose {
log.Printf("%s apparent collision", r.name)
}
r.moveto = r.selectDirection()
r.moveto = r.randomDirection()
r.speed = 0
return
}