-
Notifications
You must be signed in to change notification settings - Fork 26
Home
mdp edited this page Oct 30, 2012
·
21 revisions
Bots are written in CommonJS, and simple need to export a 'play' function
Example: At it's simplest, a bot should return a bet. Bets are essentially what's getting added to the pot. You can think about it as throwing new chips into the pot.
// I just call everything!
exports.play = function(game) {
if(game.state !== "complete") {
return game.betting.call;
}
};
You should expect to be passed a game object which contains all the relevant information you need to make a decision, including:
- game state ('pre-flop','flop', 'river', 'turn')
- players and their actions
- your own information (including your cards)
- betting options available
Here's an example of a game object after the flop.
{ community: [ 'Kh', '7c', '2c' ],
state: 'flop',
hand: 1,
betting: { call: 0, raise: 10, canRaise: true },
me:
{ name: 'Me',
blind: 5,
ante: 0,
wagered: 10,
state: 'active',
chips: 990,
actions: { 'pre-flop': [ { type: 'call', bet: 5 } ] },
cards: [ '6s', 'Qh' ],
position: 0,
brain: {} },
players:
[ { name: 'Me',
blind: 5,
ante: 0,
wagered: 10,
state: 'active',
chips: 990,
actions: { 'pre-flop': [ { type: 'call', bet: 5 } ] } },
{ name: 'CallBot #1',
blind: 10,
ante: 0,
wagered: 10,
state: 'active',
chips: 990,
actions: { 'pre-flop': [ { type: 'check' } ] } },
{ name: 'RandBot #1',
blind: 0,
ante: 0,
wagered: 10,
state: 'active',
chips: 990,
actions: { 'pre-flop': [ { type: 'call', bet: 10 } ] } } ] }
Your play
function should simply return a integer of the amount to wish to bet. This bet is in ADDITION to the amount you've already wagered.
For example, lets say you've wagered $10 so far, and are presented with the following betting state.
{ community: [ 'Kh', '7c', '2c' ],
state: 'flop',
hand: 1,
betting: { call: 10, raise: 20, canRaise: true },
me:
{ name: 'Me',
blind: 5,
ante: 0,
wagered: 10,
state: 'active',
chips: 990,
actions: { 'pre-flop': [ { type: 'call', bet: 5 } ] },
cards: [ '6s', 'Qh' ],
position: 0,
// Concatenated for brevity
- A bet of 0 will result in a fold, because you need to bet 10 in order to stay in the game.
- A bet of 10 will result in a call.
- You can also bet 20 or more in order to raise. If you've already raised and there have been
no subsequent raises, you won't be able to raise again and the
canRaise
flag will be set tofalse