float32 -> float64

This commit is contained in:
Stephen McQuay 2014-05-11 23:11:58 -07:00
parent 2b710ef40d
commit d3e7a247c8
1 changed files with 8 additions and 8 deletions

View File

@ -22,18 +22,18 @@ type Player interface {
// own Player implementations. // own Player implementations.
type SimplePlayer struct { type SimplePlayer struct {
me server.Robot me server.Robot
width, height float32 width, height float64
knownObstacles map[string]server.Obstacle knownObstacles map[string]server.Obstacle
nearestEnemy *server.OtherRobot nearestEnemy *server.OtherRobot
fireat *vector.Point2d fireat *vector.Point2d
moveto *vector.Point2d moveto *vector.Point2d
speed float32 speed float64
maxSpeed float32 maxSpeed float64
safeDistance float32 safeDistance float64
} }
// NewSimplePlayer simply returns a populated, usable *SimplePlayer // NewSimplePlayer simply returns a populated, usable *SimplePlayer
func NewSimplePlayer(width, height float32) *SimplePlayer { func NewSimplePlayer(width, height float64) *SimplePlayer {
return &SimplePlayer{ return &SimplePlayer{
knownObstacles: make(map[string]server.Obstacle), knownObstacles: make(map[string]server.Obstacle),
width: width, width: width,
@ -93,7 +93,7 @@ func (p *SimplePlayer) recon(bs *server.Boardstate) {
// shoot at where the robot will be, not where it was. // shoot at where the robot will be, not where it was.
p.nearestEnemy = nil p.nearestEnemy = nil
p.fireat = nil p.fireat = nil
closest := float32(math.Inf(1)) closest := math.Inf(1)
for _, enemy := range bs.OtherRobots { for _, enemy := range bs.OtherRobots {
dist := p.me.Position.Sub(enemy.Position).Mag() dist := p.me.Position.Sub(enemy.Position).Mag()
if dist < closest && dist > p.safeDistance { if dist < closest && dist > p.safeDistance {
@ -120,8 +120,8 @@ func (p *SimplePlayer) Instruction() map[string]server.Instruction {
func (p *SimplePlayer) randomDirection() *vector.Point2d { func (p *SimplePlayer) randomDirection() *vector.Point2d {
pt := vector.Vector2d{ pt := vector.Vector2d{
X: rand.Float32() * p.width, X: rand.Float64() * p.width,
Y: rand.Float32() * p.height, Y: rand.Float64() * p.height,
}.ToPoint() }.ToPoint()
return &pt return &pt
} }