float32-d the whole thang
This commit is contained in:
parent
9fad1a7ad3
commit
384d6c5ca2
28
main.go
28
main.go
@ -27,13 +27,13 @@ var verbose = flag.Bool("verbose", false, "run verbosly")
|
||||
|
||||
type infos struct {
|
||||
id string
|
||||
width, height float64
|
||||
width, height float32
|
||||
}
|
||||
|
||||
type Stats struct {
|
||||
Hp int `json:"hp"`
|
||||
Speed float64 `json:"speed"`
|
||||
Acceleration float64 `json:"acceleration"`
|
||||
Speed float32 `json:"speed"`
|
||||
Acceleration float32 `json:"acceleration"`
|
||||
WeaponRadius int `json:"weapon_radius"`
|
||||
ScannerRadius int `json:"scanner_radius"`
|
||||
FireRate int `json:"fire_rate"`
|
||||
@ -48,8 +48,8 @@ type Robot struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Stats Stats `json:"stats"`
|
||||
TargetSpeed float64 `json:"speed"`
|
||||
Speed float64 `json:"speed"`
|
||||
TargetSpeed float32 `json:"speed"`
|
||||
Speed float32 `json:"speed"`
|
||||
Health int `json:"health"`
|
||||
Position govector.Point2d `json:"position"`
|
||||
Heading govector.Vector2d `json:"heading"`
|
||||
@ -63,7 +63,7 @@ type Projectile struct {
|
||||
Position govector.Point2d `json:"position"`
|
||||
MoveTo govector.Point2d `json:"move_to"`
|
||||
Radius int `json:"radius"`
|
||||
Speed float64 `json:"speed"`
|
||||
Speed float32 `json:"speed"`
|
||||
Damage int `json:"damage"`
|
||||
}
|
||||
|
||||
@ -140,8 +140,8 @@ func negociate(ws *websocket.Conn, gameid string) (i *infos, err error) {
|
||||
}
|
||||
|
||||
type BoardSize struct {
|
||||
Width float64 `json:"width"`
|
||||
Height float64 `json:"height"`
|
||||
Width float32 `json:"width"`
|
||||
Height float32 `json:"height"`
|
||||
}
|
||||
var gameparam struct {
|
||||
BoardSize BoardSize `json:"boardsize"`
|
||||
@ -165,8 +165,8 @@ func negociate(ws *websocket.Conn, gameid string) (i *infos, err error) {
|
||||
Name: *botname,
|
||||
Stats: Stats{
|
||||
Hp: *hp,
|
||||
Speed: *speed,
|
||||
Acceleration: *acceleration,
|
||||
Speed: float32(*speed),
|
||||
Acceleration: float32(*acceleration),
|
||||
WeaponRadius: *weaponRadius,
|
||||
ScannerRadius: *scannerRadius,
|
||||
FireRate: *fireRate,
|
||||
@ -215,8 +215,8 @@ func main() {
|
||||
|
||||
// TODO: var target govector.Point2d
|
||||
moveto := govector.Point2d{
|
||||
X: rand.Float64() * board_info.width,
|
||||
Y: rand.Float64() * board_info.height,
|
||||
X: rand.Float32() * board_info.width,
|
||||
Y: rand.Float32() * board_info.height,
|
||||
}
|
||||
log.Printf("%+v", moveto)
|
||||
|
||||
@ -248,8 +248,8 @@ func main() {
|
||||
if govector.Distance(me.Position, moveto) < 3.0 {
|
||||
log.Printf("old: %+v: %+v", me.Position, moveto)
|
||||
moveto = govector.Point2d{
|
||||
X: rand.Float64() * board_info.width,
|
||||
Y: rand.Float64() * board_info.height,
|
||||
X: rand.Float32() * board_info.width,
|
||||
Y: rand.Float32() * board_info.height,
|
||||
}
|
||||
log.Printf("new: %+v: %+v", me.Position, moveto)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user