Categories
BLOG

powerball api

Powerball api

GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

GitHub is where the world builds software

Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Check Powerball Ticket API

Powerball is a popular US lottery game with draws twice a week. For the purposes of this exercise, a Powerball lottery “ticket” includes one or more “picks”. Each “pick” is a set of 5 integers (from 1 – 69 ) along with a 6th integer (the Powerball, from 1 – 26 ) that the user has chosen to play during a specific draw.

For example, a pick for the draw on 2017-11-09 might be:

02 14 19 21 61 25

The Powerball winning numbers change on each “draw date”. In order to determine a win or a loss, the Powerball draw dates and winning numbers are retrieved from the following URL:

The prize is calculated as per the prize matrix image below:

  • A missing subtlety is that whiteballs can not be duplicated in a draw. That has been handled here.
  • It is also possible for a ticket to have two picks, exactly the same, that both win the jackpot. In that eventuality, the player splits the prize with themself i.e. they cannot get double the money. That tricky math has not been handled here.
  • When querying for game results, it is crucial to use the eTag.
  • The code contains a few TODO statements for explanation of next steps or observations. That would be a “no-no” in real work.
  • This API needs monitoring, especially of the job that queries for game results. Ideally, the job would be extracted into a proper worker of its own.

Starting the App

From the checked-out application folder, run:

npm start or npm run start:watch to autorun on changes.

You should see output like this:

Using the Endpoint

Try the following. Play around with removing keys or changing values to test the exhaustive validation.

Given that the draw for that date has white balls of 8, 24, 42, 54, 64 and a power ball of 24 , the player’s ticket check response looks like the request but with additional annotations as follows.

To run the existing (sample) tests simply use:

npm test or npm run test:watch to autorun on changes.

An API for checking a Powerball ticket. Contribute to rcotter/lottery-ticket development by creating an account on GitHub.

Does anyone know of a Powerball API? [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 2 years ago .

I’ve already Googled about as much as anyone can on this subject, but seem to keep coming up near empty handed. When I say near, I mean, I’ve found 2 sets of script files on this site that help. I can use the two files [DynamicFeedRequest.js && getfeeddata.js] to get the info I’d like, the problem is, I can’t make it more singular. I’m trying to find a simple REST API or something of that nature that I can make a quick ajax call to for sake of a Plug-In I’m writing.

I’m still working on breaking the js files down, and that may be my end result, but I was hoping another out there might know of a simple API where I can get the “Last 10 Winning Number Sets“? Anyone?

Does anyone know of a Powerball API? [closed] Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 2 years ago . I’ve already Googled about as ]]>