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.
onEach 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.
| Event | When 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. |
e| Property | Meaning |
|---|---|
e.key | The bet that won or lost (on.win, on.lose). |
e.bet | How much was on it. |
e.amount | What came back, bet included (on.win). |
e.die1, e.die2, e.sum, e.hard | The last roll. |
e.point | The number a Come or Don't Come bet traveled to. (It is the last roll's total.) |
t| Call | What 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.
| Value | Meaning |
|---|---|
t.unit, t.propUnit | Your 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.tableMin | The 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.lastLostBet | The size of the last bet to win, and to lose. |
| Value | Meaning |
|---|---|
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.isComingOut | The point (0 when the puck is OFF), and whether it is the come out. |
t.chips, t.totalBets, t.net | Chips in the rack, chips on the table, and how far ahead of the starting bankroll you are. |
t.comeCount, t.dontComeCount | How many Come, or Don't Come, bets are on numbers. |
t.placeCount, t.buyCount, t.layCount | How 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.loseStreak | Bets won, or lost, in a row. |
t.reset()t.reset('wins'), 'rolls', 'winnings' | Clears the counts above: all of them, or one kind. |
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.
| Bets | Names |
|---|---|
| Line | passline, dontpass, come, dontcome |
| Odds | passlineodds, dontpassodds, come6odds, dontcome6odds (any point number) |
| Come bets on numbers | come4 … come10, dontcome4 … dontcome10 |
| Place, Buy, Lay | place4 … place10, buy4 … buy10, lay4 … lay10 |
| Field and Big | field, big6, big8 |
| Hardways | hardfour, hardsix, hardeight, hardten |
| One-roll | aces, 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}`));
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}`));
});
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; });
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; });
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.
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);
});
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));
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(); });
t.winCount, t.rollCount, and the rest) are kept by the table, not the script.t.set('place6', 12), and reports every wrong one at once. A name handed to your own function, like keep('palce6', 12), is only found when Check plays the script and the dice reach that line.t and on are taken. A script that declares its own t or on at the top will not load.import; copy a helper into each strategy that needs it.Math.random and Date are not available. A strategy reacts to the table and nothing else, which is what lets the simulator repeat a run exactly.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.
| Name | Bet | Notes |
|---|---|---|
| Line bets | ||
passline | Pass Line | Come out only. A contract bet: it stays until it wins or loses. |
dontpass | Don't Pass | Come out only. |
come | Come | Point phase only. Travels to the number rolled, becoming come4 … come10. |
dontcome | Don't Come | Point phase only. Travels behind the number rolled, becoming dontcome4 … dontcome10. |
| Odds | ||
passlineodds | Pass Line odds | Needs a Pass Line bet and a point. t.maxOdds('passline') is the most allowed. |
dontpassodds | Don't Pass odds (lay) | Needs a Don't Pass bet and a point. |
come4odds | Odds on the Come bet on 4 | Needs come4. |
come5odds | Odds on the Come bet on 5 | |
come6odds | Odds on the Come bet on 6 | |
come8odds | Odds on the Come bet on 8 | |
come9odds | Odds on the Come bet on 9 | |
come10odds | Odds on the Come bet on 10 | |
dontcome4odds | Odds on the Don't Come bet behind 4 | Needs dontcome4. |
dontcome5odds | Odds on the Don't Come bet behind 5 | |
dontcome6odds | Odds on the Don't Come bet behind 6 | |
dontcome8odds | Odds on the Don't Come bet behind 8 | |
dontcome9odds | Odds on the Don't Come bet behind 9 | |
dontcome10odds | Odds on the Don't Come bet behind 10 | |
| Come bets that have traveled | ||
come4 | Come bet on 4 | Read 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. |
come5 | Come bet on 5 | |
come6 | Come bet on 6 | |
come8 | Come bet on 8 | |
come9 | Come bet on 9 | |
come10 | Come bet on 10 | |
dontcome4 | Don't Come bet behind 4 | As above, from dontcome. |
dontcome5 | Don't Come bet behind 5 | |
dontcome6 | Don't Come bet behind 6 | |
dontcome8 | Don't Come bet behind 8 | |
dontcome9 | Don't Come bet behind 9 | |
dontcome10 | Don't Come bet behind 10 | |
| Place, Buy and Lay | ||
place4 | Place 4 | Multiples of $5. |
place5 | Place 5 | Multiples of $5. |
place6 | Place 6 | Multiples of $6. |
place8 | Place 8 | Multiples of $6. |
place9 | Place 9 | Multiples of $5. |
place10 | Place 10 | Multiples of $5. |
buy4 | Buy 4 | Pays true odds, less the vig. |
buy5 | Buy 5 | Multiples of $2. |
buy6 | Buy 6 | Multiples of $5. |
buy8 | Buy 8 | Multiples of $5. |
buy9 | Buy 9 | Multiples of $2. |
buy10 | Buy 10 | |
lay4 | Lay 4 | Against the number, less the vig. Multiples of $2. |
lay5 | Lay 5 | Multiples of $3. |
lay6 | Lay 6 | Multiples of $6. |
lay8 | Lay 8 | Multiples of $6. |
lay9 | Lay 9 | Multiples of $3. |
lay10 | Lay 10 | Multiples of $2. |
| Field and Big | ||
field | Field | One roll. |
big6 | Big 6 | |
big8 | Big 8 | |
| Hardways | ||
hardfour | Hard 4 | Hardways and the bets below them are prop bets: they may be smaller than the table minimum. |
hardsix | Hard 6 | |
hardeight | Hard 8 | |
hardten | Hard 10 | |
| One-roll props | ||
anyseven | Any Seven | |
anycrap | Any Craps | |
aces | Aces (2) | Also Hop 1-1. |
acedeuce | Ace-Deuce (3) | Also Hop 1-2. |
eleven | Eleven (Yo) | |
twelve | Twelve (Boxcars) | Also Hop 6-6. |
c | C | The Any Craps half of the C & E spot. |
e | E | The Eleven half of the C & E spot. |
| Hops | ||
hop22 | Hop 2-2 (hard 4) | The digits in a hop's name are not always in the same order. Copy the name from this list. |
hop31 | Hop 3-1 | |
hop32 | Hop 3-2 | |
hop41 | Hop 4-1 | |
hop33 | Hop 3-3 (hard 6) | |
hop42 | Hop 4-2 | |
hop51 | Hop 5-1 | |
hop16 | Hop 1-6 | |
hop25 | Hop 2-5 | |
hop34 | Hop 3-4 | |
hop44 | Hop 4-4 (hard 8) | |
hop53 | Hop 5-3 | |
hop62 | Hop 6-2 | |
hop54 | Hop 5-4 | |
hop63 | Hop 6-3 | |
hop55 | Hop 5-5 (hard 10) | |
hop64 | Hop 6-4 | |
| Horn and combination props | ||
horn | Horn | 2, 3, 11 and 12. Multiples of $4. |
hornhigh2 | Horn High Aces | Multiples of $5. |
hornhigh3 | Horn High Ace-Deuce | Multiples of $5. |
hornhigh11 | Horn High Yo | Multiples of $5. |
hornhigh12 | Horn High Twelve | Multiples of $5. |
comboworld | World (Whirl) | Horn and Any Seven. Multiples of $5. |
comboce | C & E | Any Craps and Eleven. Multiples of $2. |
combothreeway | Three-Way Craps | 2, 3 and 12. Multiples of $3. |
combobigred | Big Red | All three ways to roll a 7. Multiples of $3. |
combo2_12 | Hi-Low | 2 and 12. Multiples of $2. |
combo2_3 | Aces / Ace-Deuce | 2 and 3. Multiples of $2. |
combo3_11 | Ace-Deuce / Yo | 3 and 11. Multiples of $2. |
combo11_12 | Yo / Twelve | 11 and 12. Multiples of $2. |
| Side bets | ||
allsmall | All Small | 2, 3, 4, 5 and 6 before a 7. Only while none of its numbers has been marked. |
alltall | All Tall | 8, 9, 10, 11 and 12 before a 7. |
makeemall | Make 'Em All | Both. |
firebet | Fire Bet | Come out only, $1 to $5. |
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));
| Name | Call | What goes down |
|---|---|---|
| Across the numbers | ||
inside | Inside | Place 5, 6, 8, 9 |
outside | Outside | Place 4, 5, 9, 10 |
across | Across | Place 4, 5, 6, 8, 9, 10 |
ironcross | Iron Cross | Place 5, 6, 8 and the Field |
uptown | Uptown | Place 8, 9, 10 |
downtown | Downtown | Place 4, 5, 6 |
| Hardways | ||
hard68 | Hard 6 and 8 | Hard 6, Hard 8 |
hard410 | Hard 4 and 10 | Hard 4, Hard 10 |
allhardways | All the hardways | Hard 4, 6, 8, 10 |
buffalo | Buffalo | Hard 4, 6, 8, 10 and Any Seven |
| Props | ||
threewaycraps | Three-Way Craps | Aces, Ace-Deuce, Twelve, as three bets |
hilowyo | Hi-Low-Yo | Aces, Twelve, Eleven |
seveneleven | Seven-Eleven | Any Seven and e |
| Hopping a number | ||
hopthehardways | Hop the hardways | Hop 2-2, 3-3, 4-4, 5-5 |
hopthefours | Hop the fours | Hop 3-1, 2-2 |
hopthefives | Hop the fives | Hop 4-1, 3-2 |
hopthesixes | Hop the sixes | Hop 5-1, 4-2, 3-3 |
hoptheeights | Hop the eights | Hop 6-2, 5-3, 4-4 |
hopthenines | Hop the nines | Hop 6-3, 5-4 |
hopthetens | Hop the tens | Hop 6-4, 5-5 |
| One bet, sized by the dealer | ||
serviceplace4 | Place 4 | place4, in proper multiples |
serviceplace5 | Place 5 | place5, in proper multiples |
serviceplace6 | Place 6 | place6, in proper multiples |
serviceplace8 | Place 8 | place8, in proper multiples |
serviceplace9 | Place 9 | place9, in proper multiples |
serviceplace10 | Place 10 | place10, in proper multiples |
servicebuy4 | Buy 4 | buy4, in proper multiples |
servicebuy5 | Buy 5 | buy5, in proper multiples |
servicebuy6 | Buy 6 | buy6, in proper multiples |
servicebuy8 | Buy 8 | buy8, in proper multiples |
servicebuy9 | Buy 9 | buy9, in proper multiples |
servicebuy10 | Buy 10 | buy10, in proper multiples |
servicelay4 | Lay 4 | lay4, in proper multiples |
servicelay5 | Lay 5 | lay5, in proper multiples |
servicelay6 | Lay 6 | lay6, in proper multiples |
servicelay8 | Lay 8 | lay8, in proper multiples |
servicelay9 | Lay 9 | lay9, in proper multiples |
servicelay10 | Lay 10 | lay10, in proper multiples |
servicehard4 | Hard 4 | hardfour |
servicehard6 | Hard 6 | hardsix |
servicehard8 | Hard 8 | hardeight |
servicehard10 | Hard 10 | hardten |
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.