zonepick-math
v1.0.5
Published
ZonePick math engine (area, multiplier, win check, presets)
Readme
zonepick-math
ZonePick math engine for calculating areas, multipliers, win checks, and presets.
Installation
npm install zonepick-mathUsage
ESM
import { baseArea, multiplierFromPct, isWin } from 'zonepick-math';CommonJS
const { baseArea, multiplierFromPct, isWin } = require('zonepick-math');API
Constants
HE- House edge (0.02)MAX- Maximum multiplier (1000)ALPHA- Power exponent (2.3)
Functions
baseArea(pct, HEv, MAXv, ALPHAv)
Calculates the base area percentage based on a percentage value.
shapeCap(width, height, shape)
Returns the maximum area cap for a given shape ('c' = circle, 'r' = rectangle, 't' = triangle).
effArea(pct, width, height, shape, HEv, MAXv, ALPHAv)
Calculates effective area, capped by shape constraints.
multiplierFromPct(pct, width, height, shape, HEv, MAXv, ALPHAv)
Gets the multiplier value for a given percentage.
findPctForX(targetX, width, height, shape, HEv, MAXv, ALPHAv)
Finds the percentage needed to achieve a target multiplier.
geom(pct, width, height, shape)
Returns geometry data (radius for circle, side for rectangle, dimensions for triangle).
isWin(x, y, centerX, centerY, pct, width, height, shape, edgeInclusive)
Checks if a point (x, y) is within the winning zone.
makePRNG(seedStr)
Creates a deterministic PRNG from a seed string.
const prng = makePRNG('seed123');
console.log(prng()); // Random number 0-1License
MIT
