diff --git a/README.md b/README.md index e0dee1d..00159c8 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ function myStrategy ({ rules, bets, hand, playerMind }) { ... } | `noBetting` | Makes no bets. Useful as a baseline or placeholder. | | `minPassLineOnly` | Pass line bet at `minBet` on each come-out. No odds. | | `minPassLineMaxOdds` | Pass line at `minBet` + maximum odds behind the line once a point is set. | +| `minPassLineMidOdds` | Pass line at `minBet` + approximately half of maximum odds once a point is set. Odds multiple is `Math.ceil(maxOddsMultiple / 2)`. | | `minPassLineMinOdds` | Pass line at `minBet` + minimum payable odds once a point is set. Rounds up to nearest $5 for points 6/8, nearest even number for points 5/9, exact `minBet` for points 4/10. | | `placeSixEight` | Place the 6 and 8 at the nearest multiple of $6 ≥ `minBet`. No pass line. Bets come down on a win and are re-placed next turn. | | `minComeLineMaxOdds` | One come bet at `minBet` with max odds once it travels to a point. | diff --git a/betting.js b/betting.js index 71fbb63..5a2c066 100644 --- a/betting.js +++ b/betting.js @@ -81,6 +81,21 @@ function minPassLineMaxOdds (opts) { }) } +function minPassLineMidOdds (opts) { + const bets = minPassLineOnly(opts) + const { rules, hand } = opts + + if (hand.isComeOut === false && !bets?.pass?.odds) { + const maxMultiple = rules.maxOddsMultiple[hand.point] + const oddsMultiple = Math.ceil(maxMultiple / 2) + const oddsAmount = oddsMultiple * bets.pass.line.amount + bets.pass.odds = { amount: oddsAmount } + bets.new += oddsAmount + } + + return bets +} + function minPassLineMinOdds (opts) { const bets = minPassLineOnly(opts) const { rules, hand } = opts @@ -318,6 +333,7 @@ module.exports = { minPassLineOnly, lineMaxOdds, minPassLineMaxOdds, + minPassLineMidOdds, minPassLineMinOdds, placeSixEight, placeSixEightUnlessPoint, diff --git a/betting.test.js b/betting.test.js index 32c35c0..746544a 100644 --- a/betting.test.js +++ b/betting.test.js @@ -1392,3 +1392,26 @@ tap.test('minPassLineMinOdds: no odds on come-out', (t) => { t.notOk(result.pass?.odds, 'no odds on come-out') t.end() }) + +tap.test('minPassLineMidOdds: places roughly half of max odds on point set', (t) => { + const rules = { minBet: 5, maxOddsMultiple: { 4: 3, 5: 4, 6: 5, 8: 5, 9: 4, 10: 3 } } + const hand = { isComeOut: false, result: 'point set', point: 5 } + const bets = { pass: { line: { amount: 5 } } } + + const result = lib.minPassLineMidOdds({ rules, bets, hand }) + const expectedMultiple = Math.ceil(rules.maxOddsMultiple[5] / 2) + + t.ok(result.pass.odds, 'odds placed') + t.equal(result.pass.odds.amount, expectedMultiple * rules.minBet, 'odds at ceil(maxMultiple/2) * minBet') + t.end() +}) + +tap.test('minPassLineMidOdds: no odds on come-out', (t) => { + const rules = { minBet: 5, maxOddsMultiple: { 4: 3, 5: 4, 6: 5, 8: 5, 9: 4, 10: 3 } } + const hand = { isComeOut: true } + + const result = lib.minPassLineMidOdds({ rules, hand }) + + t.notOk(result.pass?.odds, 'no odds on come-out') + t.end() +})