package main import ( "flag" "fmt" "log" "math/rand" "sync" "time" ) var hp = flag.Int("hp", 50, "") var speed = flag.Int("speed", 50, "") var acceleration = flag.Int("acceleration", 50, "") var scannerRadius = flag.Int("srad", 50, "scanner radius") var turnSpeed = flag.Int("omega", 50, "turn speed") var fireRate = flag.Int("fire-rate", 50, "scanner radius") var weaponRadius = flag.Int("wrad", 50, "weapon radius") var weaponDamage = flag.Int("wdamage", 50, "weapons umph") var weaponSpeed = flag.Int("wspeed", 50, "weapons speed") // XXX: add TurnSpeed, WeaponDamage, WeaponSpeed var server = flag.String("server", "localhost", "server hostname") var port = flag.Int("port", 8666, "server port") var botname = flag.String("name", "gobot", "the name that other players will see") var botcount = flag.Int("bots", 1, "number of bots to spin up") var verbose = flag.Bool("verbose", false, "run verbosly") func main() { log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) rand.Seed(time.Now().UnixNano()) var gameName string flag.Parse() if flag.NArg() < 1 { gameName = "debug" } else { gameName = flag.Arg(0) } var wg sync.WaitGroup for i := 0; i < *botcount; i++ { r := &robot{ server: *server, port: *port, name: fmt.Sprintf("%s%d", *botname, i), game: GameParam{ name: gameName, }, // XXX: update with missing fields stats: StatsRequest{ Hp: *hp, Speed: *speed, Acceleration: *acceleration, ScannerRadius: *scannerRadius, TurnSpeed: *turnSpeed, FireRate: *fireRate, WeaponRadius: *weaponRadius, WeaponDamage: *weaponDamage, WeaponSpeed: *weaponSpeed, }, wg: &wg, knownObstacles: make(map[string]Obstacle), } wg.Add(1) go r.play() } wg.Wait() }