npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lottery-facility

v0.0.1-alpha.9

Published

Some APIs and CLI tools for designing lottery cracking systems.

Downloads

21

Readme

lottery-facility

npm version Npm package monthly downloads GitHub

Some APIs and CLI tools for designing lottery cracking systems.

Overview

Features:

  • Random numbers generator
  • Random selections of numbers
  • Draws statistics (TODO)
  • Draws prediction heuristics (TODO)

CLI utilities:

  • flash
  • combination
  • translate
  • difference
  • filter
  • euromillions_draws (TODO)
  • kenoFR_draws (TODO)

Install

Install with npm:

npm install lottery-facility
npm install --save-dev @types/lottery-facility

Quick start

CommonJS

Import in your NodeJS project with CommonJS:

const lotteryFacility = require('lottery-facility');

const box = new lotteryFacility.DrawBox(70);
const balls = box.draw(20);
console.log(balls);

ES6 or TypeScript

Import in your NodeJS project with ES6 or TypeScript:

create a file test.ts (for Typescript) or test.js (for ES6)

import { DrawBox } from 'lottery-facility';

const box = new DrawBox(70);
const balls = box.draw(20);
console.log(balls);

and compile with these commands

npx tsc test.ts
npx babel --presets=@babel/env test.js --out-file script-compiled.js

Browsers

Import in your browser project from a CDN:

<!DOCTYPE html>
<html>
<head>
  <title>Lottery-facility from CDN</title>
</head>
<body>

  <!-- Load lottery-facility library -->
  <script src="https://unpkg.com/[email protected]/dist/lotteryfacility-webbundle.min.umd.js"></script>

  <script>
  const box = new LotteryFacility.DrawBox(70);
  const balls = box.draw(20);
  document.write(balls);
  </script>

</body>
</html>

CLI utilities

All the following documentation is available in the tools by running --help on command line.

1. flash

Parameters

--verbose, -v  Verbose mode (default true).
--outfile      Output filename (optional).
--total, -t    Total number of lottery balls.
--size, -s     Size of generated combinations.
--sort         Display ordered combinations (optional).
--nb           Number of generated combinations.
--nbSwap       Number of shuffle operations. Default value 200.

Description

This script generates a random selection of lottery balls, taken from 1 to total balls. The optional parameter sort sorts combinations items in ascending order. You can put total and size pairs multiple times for random selection into multiple draw boxes.

Exemple

Generate 8 random games for Euromillions lottery

$ flash --total 50 --size 5 --total 12 --size 2 --nb 8 --sort
07 10 12 17 28 | 04 08
01 10 15 48 50 | 02 10
03 14 16 30 40 | 07 11
01 13 19 25 40 | 01 12
06 11 39 40 48 | 02 03
05 09 26 32 48 | 01 03
07 21 31 48 50 | 10 11
11 20 23 33 40 | 09 12

2. combination

Parameters

--verbose, -v   Verbose mode (default true).
--outfile       Output filename (optional).
--total, -t     Total number of arranged packets of items.
--size, -s      Number of assembled packets of items.
--file, -f      A file containing one item of combination per line.
--numbers, -n   Items of combinations separated by '|'.
--step          Size of a packet of items. Default value 1.

Description

This script generates combinations of packets of items taken in file file or list numbers, of size size packets, implementing choice of size packets among total packets. Only the first step*total items of file or numbers are used to build combinations.

Exemple

Generation of all combinations of size 3 in a list of 5 numbers (choice of 3 among 5)

$ combination --size 3 --total 5 --numbers "01|02|03|04|05|06|07|08|09|10"
01 02 03
01 02 04
01 02 05
01 03 04
01 03 05
01 04 05
02 03 04
02 03 05
02 04 05
03 04 05

3. translate

Overview In order to win lottery games, you both need a tactical game (file of several combinations) and a smart selection of numbers based on statistics study. First, you have to find good numbers with high probability to draw. The more you have winning numbers in your selection the better it is for you. Then, you also have to put the good numbers all together on a same combination. If there are too many loosing numbers in your selection, they can polluate your games. To be sure to have winning numbers on the same combination you have to make a huge amount of combinations. But you cannot afford to make all possible combinations for economical reasons. So you need to use a tactical set of combinations that can help you win if you have sufficient amount of winning numbers. In the end, you need to apply your smart selection of numbers onto your tactical game. And this is the usage of tanslate tool.

Parameters

--file, -f    A file containing one combination per line to be translated.
--originnum   Items of combinations separated by '|' or ' '.
--originfile  File containing one item per line that are used in combinations of <file> file.
--targetnum   Items of combinations separated by '|' or ' ', for the translation of combinations.
--targetfile  File containing one item per line used for the translation of <file> file.

Description

This script takes an input file file containing one combination per line. These input combinations are written with the origin alphabet and to be translated into target alphabet. Items of origin alphabet are translated to target alphabet relatively to their corresponding order of declaration. The origin alphabet can be declared either with originnum or originfile parameters. The target alphabet can be declared either with targetnum or targetfile parameters.

Exemple

We start with a tactical GAME.txt file written with the origin alphabet 01 02 03 04 05 06 07 08 09 10 11 12

$ cat GAME.txt
01 02 03 04 05 06
07 01 02 08 05 09
07 04 08 10 06 09
01 02 04 08 10 11
07 01 03 10 06 11
03 08 10 05 06 11
07 03 04 05 09 11
07 01 04 08 05 12
07 02 03 08 06 12
02 03 04 10 09 12
01 10 05 06 09 12
07 02 10 05 11 12
01 03 08 09 11 12
02 04 06 09 11 12

After many hours of statistics analysis, we select 12 high probability winning numbers. These numbers are 25 28 31 34 37 52 53 59 61 67 68 70. We need to apply this selection onto our tactical GAME.txt file. We use the translate tool to do that job with the following command

$ translate --file GAME.txt --originnum "01 02 03 04 05 06 07 08 09 10 11 12" \
--targetnum "25 28 31 34 37 52 53 59 61 67 68 70"
25 28 31 34 37 52
53 25 28 59 37 61
53 34 59 67 52 61
25 28 34 59 67 68
53 25 31 67 52 68
31 59 67 37 52 68
53 31 34 37 61 68
53 25 34 59 37 70
53 28 31 59 52 70
28 31 34 67 61 70
25 67 37 52 61 70
53 28 67 37 68 70
25 31 59 61 68 70
28 34 52 61 68 70

4. difference

Parameters

--file, -f    A file containing one combination per line to calculate the difference to.
--globalnum   All items that can be used in combinations, separated by '|' or ' '.
--globalfile  File containing one item of combination per line, items used in combinations of <file> file,
              but possibly others items.

Description

This script takes an input file file containing one combination per line, combinations written with items of the global alphabet, and returns the difference between the global alphabet and each combination. The global alphabet can be declared either with globalnum or globalfile parameters.

Exemple

We start with a GAME.txt file written with the global alphabet 01 02 03 04 05 06 07 08 09 10

$ cat GAME.txt
04 05 06 07 08 09 10
03 05 06 07 08 09 10
03 04 06 07 08 09 10
01 02 06 07 08 09 10
01 02 03 04 05 09 10
01 02 03 04 05 08 10
01 02 03 04 05 08 09
01 02 03 04 05 06 07

Computation of the difference of file GAME.txt relatively to the global alphabet 01 02 03 04 05 06 07 08 09 10

$ difference --file GAME.txt --globalnum "01 02 03 04 05 06 07 08 09 10"
01 02 03
01 02 04
01 02 05
03 04 05
06 07 08
06 07 09
06 07 10
08 09 10

5. filter

6. cartesian_product

7. paste

8. cut

9. euromillions_draws

10. kenoFR_draws

Publish a version

Build and test the project with these commands

npm install
npm run build
npm run test

You can see what files will be embedded in the new release with the command below. Files and directories listed in .gitignore and .npmignore won't be in the package. Files and directories listed in the "files:" section of package.json file will be included in the final package.

npm pack

Update the package version with one of the following commands. If inside a Git directory, the package.json file's version is changed and committed. And a new Git tag related to the new version is created.

npm version prerelease --preid=alpha
npm version prerelease --preid=beta
npm version prerelease --preid=rc
npm version patch
npm version minor
npm version major

Push the new Git tag to remote origin

git push --tags

Go to the root of the project, and publish publicly the new package version to the NPM registry. Once published a version can be deprecated, but it cannot be deleted nor re-used.

npm publish --access public

Depracation of NPM package versions

npm deprecate @claudelalyre/[email protected] "obsolete"
npm deprecate @claudelalyre/[email protected] "obsolete"

License

The project is released under the MIT license.

Contact

The project's website is located at https://github.com/lalyre/lottery-facility. Author: Claude Lalyre ([email protected])

Contributors