float32 -> float64

This commit is contained in:
Stephen McQuay 2014-05-11 23:11:58 -07:00
parent 2b710ef40d
commit d3e7a247c8

View File

@ -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
}