Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atwayne/pool_fee
library to calculate how to split the bill of a pool game
https://github.com/atwayne/pool_fee
Last synced: 12 days ago
JSON representation
library to calculate how to split the bill of a pool game
- Host: GitHub
- URL: https://github.com/atwayne/pool_fee
- Owner: atwayne
- License: mit
- Created: 2015-11-27T18:40:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-29T13:03:39.000Z (almost 9 years ago)
- Last Synced: 2023-08-05T12:11:30.302Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pool_fee
> library to calculate how to split the bill of a pool gameTo Start, create a fork of the example timeline `timeline_20151127.js`, run
```
node timeline_20151127.js
```## Features:
- Input when did each table open and close, along with how much it cost per minute```
// create a table which costs $35 per hour
var table = new Table('table_alias', 35 / 60);
// open this table at 19:00
table.JoinPool(pool, new Date('2015-11-27 19:00'));
// close this table at 21:00
table.LeftPool(pool, new Date('2015-11-27 21:00'))
```- Input when did everyone arrive and leave
```
// create player with a alias and an optional discount
var tom = new Player('tom');// join pool at 19:00
tom.JoinPool(pool,new Date('2015-11-27 19:00'));// left pool at 21:00
tom.LeftPool(pool,new Date('2015-11-27 21:00'));
```- Optional, place a discount on anyone
```
// now jerry weights 0.8 while others weights 1
var jerry = new Player('jerry',0.8);
```- Optional, charge extra money on anyone
```
// tom ate something worth $23, which should not be paid by everyone
tom.Eat(23);
```## TODO:
- Create Android App and iOS App for that