-
Notifications
You must be signed in to change notification settings - Fork 1
/
betting.js
41 lines (32 loc) · 1013 Bytes
/
betting.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function minPassLineOnly (opts) {
const { rules, bets: existingBets, hand } = opts
const bets = Object.assign({ new: 0 }, existingBets)
if (process.env.DEBUG) console.log(`[decision] make a new pass line bet?: ${hand.isComeOut} && ${!bets?.pass?.line}`)
if (hand.isComeOut && !bets?.pass?.line) {
const newPassLineBet = {
line: {
amount: rules.minBet
}
}
bets.pass = newPassLineBet
bets.new += bets.pass.line.amount
}
return bets
}
function minPassLineMaxOdds (opts) {
const bets = minPassLineOnly(opts)
const { rules, hand } = opts
if (process.env.DEBUG) console.log(`[decision] make a new pass odds bet?: ${!hand.isComeOut} && ${!bets?.pass?.odds}`)
if (hand.isComeOut === false && !bets?.pass?.odds) {
const oddsAmount = rules.maxOddsMultiple[hand.point] * bets.pass.line.amount
bets.pass.odds = {
amount: oddsAmount
}
bets.new += oddsAmount
}
return bets
}
module.exports = {
minPassLineOnly,
minPassLineMaxOdds
}