Strategy Script Reference

A strategy is a short JavaScript file. It registers handlers for things that happen at the table, and inside a handler it looks at the table and places bets. There is nothing else to it: no clock, no random numbers, no network. The same script dealt the same dice always plays the same way.

t.unit = 10;

on.comingOut(t => {
    if (!t.has('passline')) t.set('passline', t.unit);
});

on.pointPhase(t => {
    if (!t.has('passlineodds')) t.set('passlineodds', t.maxOdds('passline'));
});
The editor checks syntax as you type. Check and Save also play the script through a few thousand rolls and list anything it gets wrong, with the line. Click a problem to go to it. A script with a problem in it is not saved.

Events: on

Each takes a function. The function is given the table, t, and, if it asks for a second argument, the event, e. Handlers for the same event run in the order they were registered. Your favorite bets are put back up before any of them.

EventWhen it runs
on.betweenRolls(fn)After every roll has been paid and taken, before the next.
on.comingOut(fn)Between rolls while the puck is OFF.
on.pointPhase(fn)Between rolls while the puck is ON.
on.newPoint(fn)The moment a point is set.
on.pointHits(fn)The moment the point is made.
on.sevenOut(fn)The moment a seven ends the hand.
on.comeTravels(fn)A Come bet moves to its number. e.point is the number.
on.dontComeTravels(fn)A Don't Come bet moves behind its number. e.point is the number.
on.win(fn)
on.win('place6', fn)
on.win(['place6', 'place8'], fn)
A bet wins: any bet, one bet, or any of a list. e.key is the bet that won.
on.lose(...)The same, for a bet that loses.

The event, e

PropertyMeaning
e.keyThe bet that won or lost (on.win, on.lose).
e.betHow much was on it.
e.amountWhat came back, bet included (on.win).
e.die1, e.die2, e.sum, e.hardThe last roll.
e.pointThe number a Come or Don't Come bet traveled to. (It is the last roll's total.)

The table: t

Placing and moving bets

CallWhat it does
t.set(bet, dollars)Makes the bet exactly that amount. Safe to call every roll: a bet already at the amount is left alone. Setting it to 0 takes it down.
t.bet(bet, dollars)Adds that much to the bet.
t.reduce(bet, dollars)Takes that much off; to nothing or less removes the bet.
t.remove(bet)Takes the bet down, along with any odds behind it, and returns the chips. The roll recap shows it as "Taken Down".
t.press(bet)
t.press(bet, 'half')
t.press(bet, 'power')
Presses a bet that has just won with its winnings: all of them, half, or one and a half times the bet. Use inside on.win.
t.on(bet), t.off(bet), t.working(bet)Turns a bet on, off, or working on the come out.
t.spread(name, dollars)Places a dealer call for that many dollars in all: 'inside', 'across', 'ironcross', 'buffalo' and the rest of Appendix B.
t.spreadUnits(name, n)Places the call at n times its smallest proper size (one if n is left out).
t.spreadOver([bets], dollars)Shares an amount over your own list of bets, in proper multiples.
t.placeFavorites()Puts your starred bets back up. This already happens between rolls; call it only to do so at another moment.

The table's rules still apply. A bet that is not allowed right now, or that you cannot afford, is not placed; an amount is rounded to a proper multiple where the bet needs one; odds are capped at the table's maximum.

Amounts

ValueMeaning
t.unit, t.propUnitYour bet unit and prop bet unit. Set them at the top of the script, or change them as you play: t.unit = t.unit * 2;
t.tableMinThe table minimum.
t.validMin(bet)The smallest proper amount for that bet at this table ($6 for the 6 and 8 at a $5 table).
t.maxOdds(bet)The most odds the table allows behind that flat bet: t.maxOdds('passline'), t.maxOdds('come6'). 0 if the bet is not up.
t.amount(bet)What is on a bet now. 0 if nothing.
t.lastWonBet, t.lastLostBetThe size of the last bet to win, and to lose.

Looking at the table

ValueMeaning
t.has(bet)Whether the bet is up.
t.isWorking(bet), t.isOff(bet), t.isAuto(bet)Whether it is working, is off, or was placed by a strategy rather than by hand.
t.point, t.isComingOutThe point (0 when the puck is OFF), and whether it is the come out.
t.chips, t.totalBets, t.netChips in the rack, chips on the table, and how far ahead of the starting bankroll you are.
t.comeCount, t.dontComeCountHow many Come, or Don't Come, bets are on numbers.
t.placeCount, t.buyCount, t.layCountHow many of the six numbers have a Place, a Buy, or a Lay bet on them.
t.winCount(bet, ...), t.loseCount(bet, ...), t.winnings(bet, ...)Wins, losses and winnings for one bet, or the total over several.
t.rolls, t.rollCount(n), t.rollsSince(n)Rolls so far, how many of them were n, and how many since the last n.
t.winStreak, t.loseStreakBets won, or lost, in a row.
t.reset()
t.reset('wins'), 'rolls', 'winnings'
Clears the counts above: all of them, or one kind.

Bet names

Lowercase, no spaces. A name the table does not know is reported as a problem, with its line. The common ones are below; Appendix A lists every bet and Appendix B every spread.

BetsNames
Linepassline, dontpass, come, dontcome
Oddspasslineodds, dontpassodds, come6odds, dontcome6odds (any point number)
Come bets on numberscome4 … come10, dontcome4 … dontcome10
Place, Buy, Layplace4 … place10, buy4 … buy10, lay4 … lay10
Field and Bigfield, big6, big8
Hardwayshardfour, hardsix, hardeight, hardten
One-rollaces, acedeuce, eleven, twelve, anyseven, anycrap, and the hops: hop16, hop25, hop34, …

When the number is not known until the moment, build the name: t.set(`come${e.point}odds`, t.maxOdds(`come${e.point}`));

Examples

3-Point Molly

t.unit = 10;

on.comingOut(t => {
    if (!t.has('passline')) t.set('passline', t.unit);
});

on.pointPhase(t => {
    if (t.has('passline') && !t.has('passlineodds')) t.set('passlineodds', t.maxOdds('passline'));
    if (t.comeCount < 2) t.set('come', t.unit);
});

on.comeTravels((t, e) => {
    t.set(`come${e.point}odds`, t.maxOdds(`come${e.point}`));
});

Press the 6 and 8 every second hit

A script can keep count of things for itself. Its variables start over when the strategy is activated.

let hits = 0;

on.pointPhase(t => {
    if (!t.has('place6')) t.set('place6', 12);
    if (!t.has('place8')) t.set('place8', 12);
});

on.win(['place6', 'place8'], (t, e) => {
    hits++;
    if (hits % 2 === 0 && t.amount(e.key) < 60) t.press(e.key);
});

on.sevenOut(() => { hits = 0; });

Double the unit after a loss, up to a limit

const base = 10;
t.unit = base;

on.comingOut(t => {
    if (!t.has('passline')) t.set('passline', t.unit);
});

on.lose('passline', t => { t.unit = Math.min(t.unit * 2, 80); });
on.win('passline', t => { t.unit = base; });

Writing your own functions

A script is ordinary JavaScript, so whatever the table does not give you, you can write: a function, a list, a running count, a class. t and on are available everywhere in the script, so a helper at the top can read the table without being handed it.

A total the table does not have

const inside = ['place5', 'place6', 'place8', 'place9'];

// Dollars on a list of bets
const total = bets => bets.reduce((sum, bet) => sum + t.amount(bet), 0);

on.pointPhase(t => {
    if (total(inside) < 100) t.spread('inside', 44);
});

A helper you call from several handlers

function keep(bet, dollars) {
    if (!t.has(bet)) t.set(bet, dollars);
}

on.pointPhase(() => {
    keep('place6', 12);
    keep('place8', 12);
});

on.pointHits(() => keep('field', 5));

A progression that remembers where it is

const steps = [12, 18, 30, 60];
let rung = 0;
const hitsByBet = new Map();

on.pointPhase(t => {
    const dollars = steps[Math.min(rung, steps.length - 1)];
    if (!t.has('place6')) t.set('place6', dollars);
    if (!t.has('place8')) t.set('place8', dollars);
});

on.win(['place6', 'place8'], (t, e) => {
    hitsByBet.set(e.key, (hitsByBet.get(e.key) || 0) + 1);
    const hits = [...hitsByBet.values()].reduce((a, b) => a + b, 0);
    if (hits % 3 === 0) rung++;
});

on.sevenOut(() => { rung = 0; hitsByBet.clear(); });

Things to know

Limits

Appendix A: every bet

These are the names t.set, t.bet, t.has, t.amount, on.win and the rest understand. They are lowercase with no spaces. Any other name is reported as a problem, with its line.

The table's rules decide whether a bet goes down, whatever the script asks for: a Pass Line bet is not taken once a point is on, odds need their flat bet, an amount is rounded to a proper multiple, and a bet you cannot afford is skipped.

NameBetNotes
Line bets
passlinePass LineCome out only. A contract bet: it stays until it wins or loses.
dontpassDon't PassCome out only.
comeComePoint phase only. Travels to the number rolled, becoming come4 … come10.
dontcomeDon't ComePoint phase only. Travels behind the number rolled, becoming dontcome4 … dontcome10.
Odds
passlineoddsPass Line oddsNeeds a Pass Line bet and a point. t.maxOdds('passline') is the most allowed.
dontpassoddsDon't Pass odds (lay)Needs a Don't Pass bet and a point.
come4oddsOdds on the Come bet on 4Needs come4.
come5oddsOdds on the Come bet on 5
come6oddsOdds on the Come bet on 6
come8oddsOdds on the Come bet on 8
come9oddsOdds on the Come bet on 9
come10oddsOdds on the Come bet on 10
dontcome4oddsOdds on the Don't Come bet behind 4Needs dontcome4.
dontcome5oddsOdds on the Don't Come bet behind 5
dontcome6oddsOdds on the Don't Come bet behind 6
dontcome8oddsOdds on the Don't Come bet behind 8
dontcome9oddsOdds on the Don't Come bet behind 9
dontcome10oddsOdds on the Don't Come bet behind 10
Come bets that have traveled
come4Come bet on 4Read these with t.has, t.amount and t.maxOdds. To get one, bet come and let it travel; placed directly, the table turns it into something else.
come5Come bet on 5
come6Come bet on 6
come8Come bet on 8
come9Come bet on 9
come10Come bet on 10
dontcome4Don't Come bet behind 4As above, from dontcome.
dontcome5Don't Come bet behind 5
dontcome6Don't Come bet behind 6
dontcome8Don't Come bet behind 8
dontcome9Don't Come bet behind 9
dontcome10Don't Come bet behind 10
Place, Buy and Lay
place4Place 4Multiples of $5.
place5Place 5Multiples of $5.
place6Place 6Multiples of $6.
place8Place 8Multiples of $6.
place9Place 9Multiples of $5.
place10Place 10Multiples of $5.
buy4Buy 4Pays true odds, less the vig.
buy5Buy 5Multiples of $2.
buy6Buy 6Multiples of $5.
buy8Buy 8Multiples of $5.
buy9Buy 9Multiples of $2.
buy10Buy 10
lay4Lay 4Against the number, less the vig. Multiples of $2.
lay5Lay 5Multiples of $3.
lay6Lay 6Multiples of $6.
lay8Lay 8Multiples of $6.
lay9Lay 9Multiples of $3.
lay10Lay 10Multiples of $2.
Field and Big
fieldFieldOne roll.
big6Big 6
big8Big 8
Hardways
hardfourHard 4Hardways and the bets below them are prop bets: they may be smaller than the table minimum.
hardsixHard 6
hardeightHard 8
hardtenHard 10
One-roll props
anysevenAny Seven
anycrapAny Craps
acesAces (2)Also Hop 1-1.
acedeuceAce-Deuce (3)Also Hop 1-2.
elevenEleven (Yo)
twelveTwelve (Boxcars)Also Hop 6-6.
cCThe Any Craps half of the C & E spot.
eEThe Eleven half of the C & E spot.
Hops
hop22Hop 2-2 (hard 4)The digits in a hop's name are not always in the same order. Copy the name from this list.
hop31Hop 3-1
hop32Hop 3-2
hop41Hop 4-1
hop33Hop 3-3 (hard 6)
hop42Hop 4-2
hop51Hop 5-1
hop16Hop 1-6
hop25Hop 2-5
hop34Hop 3-4
hop44Hop 4-4 (hard 8)
hop53Hop 5-3
hop62Hop 6-2
hop54Hop 5-4
hop63Hop 6-3
hop55Hop 5-5 (hard 10)
hop64Hop 6-4
Horn and combination props
hornHorn2, 3, 11 and 12. Multiples of $4.
hornhigh2Horn High AcesMultiples of $5.
hornhigh3Horn High Ace-DeuceMultiples of $5.
hornhigh11Horn High YoMultiples of $5.
hornhigh12Horn High TwelveMultiples of $5.
comboworldWorld (Whirl)Horn and Any Seven. Multiples of $5.
comboceC & EAny Craps and Eleven. Multiples of $2.
combothreewayThree-Way Craps2, 3 and 12. Multiples of $3.
combobigredBig RedAll three ways to roll a 7. Multiples of $3.
combo2_12Hi-Low2 and 12. Multiples of $2.
combo2_3Aces / Ace-Deuce2 and 3. Multiples of $2.
combo3_11Ace-Deuce / Yo3 and 11. Multiples of $2.
combo11_12Yo / Twelve11 and 12. Multiples of $2.
Side bets
allsmallAll Small2, 3, 4, 5 and 6 before a 7. Only while none of its numbers has been marked.
alltallAll Tall8, 9, 10, 11 and 12 before a 7.
makeemallMake 'Em AllBoth.
firebetFire BetCome out only, $1 to $5.

Appendix B: every spread

A spread is a dealer's call: one amount, shared over several bets in proper multiples. Use these names with t.spread(name, dollars) and t.spreadUnits(name, n), never with t.set. What goes down are the bets in the right-hand column, and those are the names to use with t.has, t.amount and on.win.

on.newPoint(t => t.spread('across', 64));

on.win(['place6', 'place8'], (t, e) => t.press(e.key));
NameCallWhat goes down
Across the numbers
insideInsidePlace 5, 6, 8, 9
outsideOutsidePlace 4, 5, 9, 10
acrossAcrossPlace 4, 5, 6, 8, 9, 10
ironcrossIron CrossPlace 5, 6, 8 and the Field
uptownUptownPlace 8, 9, 10
downtownDowntownPlace 4, 5, 6
Hardways
hard68Hard 6 and 8Hard 6, Hard 8
hard410Hard 4 and 10Hard 4, Hard 10
allhardwaysAll the hardwaysHard 4, 6, 8, 10
buffaloBuffaloHard 4, 6, 8, 10 and Any Seven
Props
threewaycrapsThree-Way CrapsAces, Ace-Deuce, Twelve, as three bets
hilowyoHi-Low-YoAces, Twelve, Eleven
sevenelevenSeven-ElevenAny Seven and e
Hopping a number
hopthehardwaysHop the hardwaysHop 2-2, 3-3, 4-4, 5-5
hopthefoursHop the foursHop 3-1, 2-2
hopthefivesHop the fivesHop 4-1, 3-2
hopthesixesHop the sixesHop 5-1, 4-2, 3-3
hoptheeightsHop the eightsHop 6-2, 5-3, 4-4
hoptheninesHop the ninesHop 6-3, 5-4
hopthetensHop the tensHop 6-4, 5-5
One bet, sized by the dealer
serviceplace4Place 4place4, in proper multiples
serviceplace5Place 5place5, in proper multiples
serviceplace6Place 6place6, in proper multiples
serviceplace8Place 8place8, in proper multiples
serviceplace9Place 9place9, in proper multiples
serviceplace10Place 10place10, in proper multiples
servicebuy4Buy 4buy4, in proper multiples
servicebuy5Buy 5buy5, in proper multiples
servicebuy6Buy 6buy6, in proper multiples
servicebuy8Buy 8buy8, in proper multiples
servicebuy9Buy 9buy9, in proper multiples
servicebuy10Buy 10buy10, in proper multiples
servicelay4Lay 4lay4, in proper multiples
servicelay5Lay 5lay5, in proper multiples
servicelay6Lay 6lay6, in proper multiples
servicelay8Lay 8lay8, in proper multiples
servicelay9Lay 9lay9, in proper multiples
servicelay10Lay 10lay10, in proper multiples
servicehard4Hard 4hardfour
servicehard6Hard 6hardsix
servicehard8Hard 8hardeight
servicehard10Hard 10hardten

The horn and combination props in Appendix A (horn, comboworld, comboce and the rest) can also be given to t.spread, which sizes them in proper multiples.