Skip to content

Commit

Permalink
chore: bulk-mine strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
mindrunner committed Sep 2, 2024
1 parent 1e2b827 commit 6aeb960
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Player } from '../lib/sage/state/user-account'
import { WorldMap } from '../lib/sage/state/world-map'
import { galaxySectorsData } from '../lib/util/galaxy-sectors-data'

export const atlasnetFcStrategy =
export const atlasnetMudStrategy =
(count: number) =>
(map: WorldMap, player: Player): Map<string, Strategy> => {
const ans: Map<string, Strategy> = new Map<string, Strategy>()
Expand Down
31 changes: 31 additions & 0 deletions src/main/basedbot/fleet-strategies/atlasnet-ustur-strategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { mine } from '../fsm/configs/mine'
import { createMiningStrategy } from '../fsm/mine'
import { Strategy } from '../fsm/strategy'
import { Player } from '../lib/sage/state/user-account'
import { WorldMap } from '../lib/sage/state/world-map'
import { galaxySectorsData } from '../lib/util/galaxy-sectors-data'

export const atlasnetUsturStrategy =
(count: number) =>
(map: WorldMap, player: Player): Map<string, Strategy> => {
const ans: Map<string, Strategy> = new Map<string, Strategy>()
const sectors = galaxySectorsData()
.filter((sector) => sector.closestFaction === player.faction)
.sort((a, b) => a.name.localeCompare(b.name))

for (let i = 0; i < count; i++) {
ans.set(
`basedbot-ustur-${i}`,
createMiningStrategy(
mine(
map,
player.homeCoordinates,
sectors[i % sectors.length].coordinates,
),
player,
),
)
}

return ans
}
7 changes: 5 additions & 2 deletions src/main/basedbot/fleet-strategies/get-fleet-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Strategy } from '../fsm/strategy'
import { Player } from '../lib/sage/state/user-account'
import { WorldMap } from '../lib/sage/state/world-map'

import { atlasnetFcStrategy } from './atlasnet-fc-strategy'
import { atlasnetMudStrategy } from './atlasnet-mud-strategy'
import { atlasnetLuStrategy } from './atlasnet-lu-strategy'
import { atlasnetUsturStrategy } from './atlasnet-ustur-strategy'
import { mainnetLuStrategy } from './mainnet-lu-strategy'

export const getFleetStrategy = (
Expand All @@ -16,7 +17,9 @@ export const getFleetStrategy = (
case 'AePY3wEoUFcFuXeUU9X26YK6tNKQMZovBgvY54LK2B8N':
return mainnetLuStrategy(map, player)
case 'CgHvzwGbwWv3CwLTvEgeqSKeD8EwMdTfiiCG3dFrKVVC':
return atlasnetFcStrategy(100)(map, player)
return atlasnetMudStrategy(100)(map, player)
case '9KBrgWVjsmdZ3YEjcsa3wrbbJREgZgS7vDbgoz2aHaNm':
return atlasnetUsturStrategy(100)(map, player)
default:
throw new Error('Unknown strategy')
}
Expand Down

0 comments on commit 6aeb960

Please sign in to comment.