lucky
Description
CLI tool to measure the state of your luck at the moment.
What's it for?
Before any important move in your life, you should first consult this tool to see if the timing is right. You can even execute other commands only if your luck is effectively above average.
Installation
$ npm install lucky -g
Options
$ lucky --help Usage: lucky [options] CLI tool to measure the state of your luck, at the moment Options: -h, --help output usage information -V, --version output the version number -o, --opponents <n> Number of opponents competing [default 1] -r, --rounds <n> Number of rounds simulated [default 100] -C, --no-colors Do not use fancy colors in output -v, --verbose [level] Verbosity level [default 1] -s, --silent Alias
Examples
Minimal verbosity, just show me my luck
$ luckyYour luck is 8% above average
Include the data behind that luck
$ lucky -o 2 -r 100 -v 2You won 32 out of 100 rounds against 2 opponentYour luck is 4% below average
Include the winner of each round
$ lucky -r 5 -v 3Round 1-> The winner is CPU 1Round 2-> The winner is HumanRound 3-> The winner is CPU 1Round 4-> The winner is CPU 1Round 5-> The winner is CPU 1You won 1 out of 5 rounds against 1 opponentYour luck is 60% below average
Include the score of each player on each round
$ lucky -r 3 -vRound 1-> Human scored: 111-> CPU 1 scored: 166-> The winner is CPU 1Round 2-> Human scored: 143-> CPU 1 scored: 112-> The winner is HumanRound 3-> Human scored: 178-> CPU 1 scored: 127-> The winner is HumanYou won 2 out of 3 rounds against 1 opponentYour luck is 33% above average
Execute different commands depending on whether luck is above average or not
$ lucky -s && echo "Buy a lottery ticket" || echo "Go watch TV"Go watch TV
Pretend to be a Magic 8-ball
$ lucky -8Definitely!$ lucky -8Nope
Log you luck, add it to a cron and then you can make charts and whatnot
$ echo `date "+%Y-%m-%d %H:%M:%S"` `lucky -n`% >> ~/luck.log
How does it measure my luck?
It simulates a match against opponents and compares your win-rate against the expected average.
LICENSE
The MIT License (MIT)
Copyright (c) 2015 Ariel Flesler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.