m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dice.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dice.js b/src/dice.js
index c8a2572..5edc892 100644
--- a/src/dice.js
+++ b/src/dice.js
@@ -1,7 +1,11 @@
const constant = n => () => [n]
+const pool = (die) => {
+ return die()
+}
+
const roll = (die) => {
- return die().reduce((a, b) => (a + b))
+ return pool(die).reduce((a, b) => (a + b))
}
const d = (number, sides) => {
@@ -37,8 +41,10 @@ const subtract = (die1, die2) => {
}
}
+exports.pool = pool
+exports.roll = roll
exports.constant = constant
exports.d = d
exports.add = add
exports.subtract = subtract
-exports.roll = roll
+exports.negative = negative