From d3e7a247c8c534543f9c35df6a1c1caffeb64d2c Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Sun, 11 May 2014 23:11:58 -0700 Subject: [PATCH] float32 -> float64 --- player.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/player.go b/player.go index 9af65ac..23de06d 100644 --- a/player.go +++ b/player.go @@ -22,18 +22,18 @@ type Player interface { // own Player implementations. type SimplePlayer struct { me server.Robot - width, height float32 + width, height float64 knownObstacles map[string]server.Obstacle nearestEnemy *server.OtherRobot fireat *vector.Point2d moveto *vector.Point2d - speed float32 - maxSpeed float32 - safeDistance float32 + speed float64 + maxSpeed float64 + safeDistance float64 } // NewSimplePlayer simply returns a populated, usable *SimplePlayer -func NewSimplePlayer(width, height float32) *SimplePlayer { +func NewSimplePlayer(width, height float64) *SimplePlayer { return &SimplePlayer{ knownObstacles: make(map[string]server.Obstacle), width: width, @@ -93,7 +93,7 @@ func (p *SimplePlayer) recon(bs *server.Boardstate) { // shoot at where the robot will be, not where it was. p.nearestEnemy = nil p.fireat = nil - closest := float32(math.Inf(1)) + closest := math.Inf(1) for _, enemy := range bs.OtherRobots { dist := p.me.Position.Sub(enemy.Position).Mag() if dist < closest && dist > p.safeDistance { @@ -120,8 +120,8 @@ func (p *SimplePlayer) Instruction() map[string]server.Instruction { func (p *SimplePlayer) randomDirection() *vector.Point2d { pt := vector.Vector2d{ - X: rand.Float32() * p.width, - Y: rand.Float32() * p.height, + X: rand.Float64() * p.width, + Y: rand.Float64() * p.height, }.ToPoint() return &pt }