Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / getLeaderDeployCommands

Function: getLeaderDeployCommands() ​

getLeaderDeployCommands(snapshot): GameCommand[]

Defined in: packages/ts-sdk/src/actionable.ts:125

Builds gameplay commands for every projected leader deploy action.

Example:

ts
import { createSimulatorClient, getLeaderDeployCommands } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const matchSnapshot = await simulatorClient.matches.get('match_123')

// One ready-to-send command per legal deploy in the snapshot.
console.log(getLeaderDeployCommands(matchSnapshot))

Parameters ​

snapshot ​

Example:

ts
import { createSimulatorClient, getLeaderDeployCommands } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const matchSnapshot = await simulatorClient.matches.get('match_123')

// One ready-to-send command per legal deploy in the snapshot.
console.log(getLeaderDeployCommands(matchSnapshot))

GameState

Returns ​

GameCommand[]

Released under the MIT License.