powerball

0.8.0 • Public • Published

powerball

My attempt at predicting Powerball numbers with nodejs

npm version

See it in action here

command-line

I included the command powerball, if you install with npm install -g powerball that will predict/check numbers.

Usage: powerball [options] [numbers]

Options:
  -h, --help       Show help
  --count, -c      Count of number sets to return.              [default: 10]
  --powerplay, -p  For checking: did you enable powerplay?      [boolean]
  --time, -t       What time should the rules be pulled from?   [default: now]

Examples:
  powerball -c 5               Get 5 numbersto play
  powerball 01 18 41 43 46 22  See if your numbers got pulled in last draw

Objects

Statistical : object
Powerball : object

Statistical : object

Kind: global namespace

Statistical.μ(freq) ⇒ Number

Calculate arithmetic mean of ball-count

Kind: static method of Statistical
Returns: Number - Arithmatic Mean of weights

Param Type Description
freq Object A single ball-frequency array from frequencies

Example (Get Arithmetic Mean of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.μ(f.red)) Example (Get Arithmetic Mean of White Balls)
console.log(powerball.mean(f.white))

Statistical.gmean(freq) ⇒ Number

Calculate geometric mean of ball-count

Kind: static method of Statistical
Returns: Number - Geometric Mean of weights

Param Type Description
freq Object A single ball-frequency array from frequencies

Example (Get Geometric Mean of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.gmean(f.red)) Example (Get Geometric Mean of White Balls)
console.log(powerball.gmean(f.white))

Statistical.median(freq) ⇒ Number

Calculate median of ball-count

Kind: static method of Statistical
Returns: Number - Median of weights

Param Type Description
freq Object A single ball-frequency array from frequencies

Example (Get Median of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.median(f.red)) Example (Get Median of White Balls)
console.log(powerball.median(f.white))

Statistical.range(freq) ⇒ Array

Calculate range of ball-count

Kind: static method of Statistical
Returns: Array - High/low range of numbers for weights.

Param Type Description
freq Object A single ball-frequency array from frequencies

Example (Get Range of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.range(f.red)) Example (Get Range of White Balls)
console.log(powerball.range(f.white))

Statistical.σ(freq) ⇒ Number

Calculate standard deviation of ball-count

Kind: static method of Statistical
Returns: Number - Standard Deviation of weights

Param Type Description
freq Object A single ball-frequency array from frequencies

Example (Get Standard Deviation of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.stddev(f.red)) Example (Get Standard Deviation of White Balls)
console.log(powerball.σ(f.white))

Powerball : object

Kind: global namespace

Powerball.balls([date]) ⇒ Array

Get ball-maxes for a given date

Kind: static method of Powerball
Returns: Array - white, red ball-max

Param Type Default Description
[date] Date now Date to check

Example (Current Ball Maxes)
// returns [69, 26] powerball.balls() Example (Old Ball Maxes)
// returns [59, 39] powerball.balls(new Date('1/8/2009'))

Powerball.numbers() ⇒ Promise

Get past winning numbers

Kind: static method of Powerball
Returns: Promise - Resolves to array of winner objects
Example (Get Current Numbers)
powerball.numbers().then(winners => { console.log(winners) })

Powerball.frequencies(winners) ⇒ Object

Calculate frequencies of white & red balls

Kind: static method of Powerball
Returns: Object - keyed with number, value is frequency

Param Type Description
winners Array The winning numbers from numbers

Example (Get Frequency Counts)
console.log(powerball.frequencies(winners))

Powerball.predict(white, red, [time]) ⇒ Array

Predict winning numbers

Kind: static method of Powerball
Returns: Array - The numbers you should play

Param Type Default Description
white Object White ball-frequency array from frequencies
red Object Red ball-frequency array from frequencies
[time] Date now Different dates have differnt ball-sets

Example (Get Prediction)
var f = powerball.frequencies(winners) console.log(powerball.predict(f.white, f.red)) Example (Predict For an Old Date)
console.log(powerball.predict(f.white, f.red, new Date('1/1/98')))

Powerball.payout(pick, winner, powerplay) ⇒ Boolean | Number

Check if your numbers won (only current rules) http://www.powerball.com/powerball/pb_prizes.asp

Kind: static method of Powerball
Returns: Boolean | Number - true for jackpot, if Number: amount you won

Param Type Description
pick Array Your number picks (6-length array)
winner Object A single draw from number()
powerplay Boolean Did you mark power-play on your ticket?

Example (Check If You Won)
powerball.numbers().then(winners => { console.log(powerbal.payout([5, 6, 10, 36, 43, 11], winners.pop(), true)) })

Package Sidebar

Install

npm i powerball

Weekly Downloads

0

Version

0.8.0

License

MIT

Last publish

Collaborators

  • konsumer