func scan(ship *dtl.Ship) ([]*dtl.Ship, []*dtl.Sector, error) { for { if ship.CanScan() { return ship.ScanSector() } time.Sleep(1 * time.Second) } }
func evac(ship *dtl.Ship, escapeSector *dtl.Sector) error { for { if ship.CanTravel() { fmt.Printf("Evaccing to %s\n", escapeSector.Name) return ship.Travel(escapeSector) } time.Sleep(1 * time.Second) } }
func travel(ship *dtl.Ship, sector *dtl.Sector) error { for { if ship.CanTravel() { fmt.Printf("Travelling to %s\n", sector.Name) return ship.Travel(sector) } time.Sleep(1 * time.Second) } }
func fireLoop(ship, target *dtl.Ship) error { for { if ship.CanFire() { fmt.Printf("Fixing on %s\n", target.Name) if err := ship.Fire(target.Name); err != nil { fmt.Println("Fail!") return err } else { fmt.Println("HIT!") } } time.Sleep(1 * time.Second) } }