|
|
@@ -31,7 +31,7 @@ func (s *SimpleStrategy) Execute(stars []*models.Star, flights []models.Flight, |
|
|
|
// Determine target for this source |
|
|
|
for j, t := range stars { |
|
|
|
// Only target non-owned or enemy stars |
|
|
|
if t.Owner != -1 && t.Owner != 2 { |
|
|
|
if t.Friendly() || t.OwnedByMe() { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
@@ -45,13 +45,18 @@ func (s *SimpleStrategy) Execute(stars []*models.Star, flights []models.Flight, |
|
|
|
// If enemy star, make sure we have enough ships to attack it |
|
|
|
//if t.Owner == 2 && (s.Ships - (t.Ships + (flightTurnDistance * t.Richness))) <= 1 { |
|
|
|
insufficientShips := (s.Ships / 2) <= ((t.Ships + (flightTurnDistance * t.Richness)) + 5) |
|
|
|
if t.Owner == 2 && insufficientShips { |
|
|
|
if t.Enemy() && insufficientShips { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
shipCount := s.Ships / 2 |
|
|
|
if shipCount < 6 { |
|
|
|
shipCount = 6 |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: Find best destination |
|
|
|
// Fly to this target, and skip processing all remaining potential target stars |
|
|
|
fmt.Printf("fly %d %d %d\n", i, j, s.Ships/2) |
|
|
|
fmt.Printf("fly %d %d %d\n", i, j, shipCount) |
|
|
|
s.FlightsAllowed-- |
|
|
|
break |
|
|
|
} |