Files
botfights/server/src/fight-loop-cli.ts
T

24 lines
915 B
TypeScript
Raw Normal View History

import './db/index.js'
import { startFightLoop } from './engine/fight-loop.js'
const args = process.argv.slice(2)
const maxFights = parseInt(args.find(a => a.startsWith('--max='))?.split('=')[1] || '0') || Infinity
const intervalMs = parseInt(args.find(a => a.startsWith('--interval='))?.split('=')[1] || '0') || 8000
const style = (args.find(a => a.startsWith('--style='))?.split('=')[1] || 'mixed') as 'random' | 'elo_close' | 'mixed'
console.log('[botfights] fight loop CLI')
console.log(` max fights: ${maxFights === Infinity ? 'unlimited' : maxFights}`)
console.log(` interval: ${intervalMs}ms`)
console.log(` style: ${style}`)
console.log('')
startFightLoop({ maxFights, intervalMs, matchmakingStyle: style })
.then(() => {
console.log('[botfights] fight loop finished')
process.exit(0)
})
.catch((err) => {
console.error('[botfights] fight loop error:', err)
process.exit(1)
})