Skip to content

Instantly share code, notes, and snippets.

@mattmazzola
Created November 23, 2020 02:23
Show Gist options
  • Save mattmazzola/871ba764e963676f7067b0d1b2987254 to your computer and use it in GitHub Desktop.
Save mattmazzola/871ba764e963676f7067b0d1b2987254 to your computer and use it in GitHub Desktop.
Create Players
// Create players
const initialRating = 1000
const numPlayers = 10
const playerTiers = 5
const playerRatingRange = 6000 - initialRating
const playerSegmentSize = Math.floor(numPlayers / playerTiers)
const playerIncrementAmount = Math.floor(playerRatingRange / playerTiers)
const playerGeneration = {
total: numPlayers,
tiers: playerTiers,
ratingRange: playerRatingRange,
segmentSize: playerSegmentSize,
incrementAmount: playerIncrementAmount
}
const createPlayersFn = (prefix: string) => createPlayers(
prefix,
playerGeneration.total,
initialRating,
playerGeneration.segmentSize,
playerGeneration.incrementAmount
)
const players = createPlayersFn('player')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment