Skip to content

Commit

Permalink
feat: make ships phase-dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Mar 10, 2024
1 parent 8e3e0c7 commit c7a1e33
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/cli/lib/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class Config {
/// https://docs.spacetraders.io/api-guide/rate-limits
double targetRequestsPerSecond = 2;

/// Our ship buy plan for computeNextShipToBuy.
final buyPlan = [
final _boostrapShips = [
ShipType.LIGHT_HAULER,
ShipType.LIGHT_HAULER,
ShipType.LIGHT_HAULER,
Expand All @@ -74,6 +73,9 @@ class Config {
ShipType.MINING_DRONE,
ShipType.MINING_DRONE,
for (int i = 0; i < 13; i++) ShipType.LIGHT_HAULER,
];

final _explorationShips = [
// Only buy after gate opens.
for (int i = 0; i < 20; i++) ShipType.PROBE,
for (int i = 0; i < 10; i++) ShipType.REFINING_FREIGHTER,
Expand All @@ -85,6 +87,17 @@ class Config {
for (int i = 0; i < 20; i++) ShipType.PROBE,
];

/// Our ship buy plan for computeNextShipToBuy.
List<ShipType> get buyPlan {
final ships = <ShipType>[];
if (gamePhase == GamePhase.bootstrap) {
ships.addAll(_boostrapShips);
} else if (gamePhase >= GamePhase.exploration) {
ships.addAll(_explorationShips);
}
return ships;
}

// TODO(eseidel): Should be some dynamic min count of light-haulers before we
// start making miner haulers, and then some max count of miner haulers?
/// Number of haulers to use as miner haulers.
Expand Down

0 comments on commit c7a1e33

Please sign in to comment.