Solving

Later streets

The next street starts from one exit of a solved street and one card. There are three ways to ask for it. All three use POST /v1/solves.

In short

  • Step by step: send parent, the line and the card. Your program decides after each street.
  • One line: add then to the spot. The server solves the flop, the turn and the river in order.
  • Many lines and cards: add expand. The size grows fast, so ask for an estimate first.
  • Each solved street is one call.

Choose a way

Choose by who decides what comes next: your program after each street, or the server from a plan you send one time.

The three ways side by side
WayYou sendUse it when
Step by stepparent, line, cardYour program reads each street before it chooses the next line or card.
One linethe spot and thenYou know the line and the cards: one hand from flop to river.
Many lines and cardsthe spot and expandYou want a whole street or two below a spot: all lines, all or some cards.

Way 1 of 3

Step by step with parent

Use this whenyour program reads each street before it chooses the next line or card.

Name a complete solve as parent, the line that ended its street (line or exit_id) and the next card. The new solve starts with the pot, the stack and the ranges of that exit.

# the turn was solved in the quick start: check, bet 33, call, then the 2 of clubs
# the river: the turn went check, check (exit n2), the 9 of diamonds comes
curl -sS -X POST "$GECKO_API/v1/solves" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" -H "Prefer: wait=30" \
  -d "$(jq -n --arg parent "$TURN" '{parent: $parent, exit_id: "n2", card: "9d"}')"
The rules of a parent request
  • The parent must be complete (409 parent_not_complete) and not expired (410 parent_expired).
  • The card must not be on the board. A river solve has no next street.
  • With both line and exit_id in the body, exit_id is used.
  • A parent body ignores board, pot, stack and ranges: they come from the parent and its exit.
  • A request with parent can also carry then or expand to go on from the new street.
  • A solve cannot be a parent after a solver update, even inside its 6 days. The new solve then fails with the error code parent_unavailable, and the call is returned. Solve the street before it again. For a long study, solve the streets of one hand close together in time.

Way 2 of 3

One line with then

Use this whenyou know the line and the cards before you start: one hand from the flop to the river.

Add then to the spot: one step for each later street, at most two. Each step is the line that ends the street before it, and the card that comes: a step needs both.

A card that is on the board, or the same card in two steps, is refused. The server runs the solves in order.

{
  "board": ["As", "Ks", "7h"], "pot": 100, "stack": 300,
  "ranges": [{"AA": 1, "AKs": 1, "QQ": 1}, {"KK": 1, "AQs": 1, "JTs": 1}],
  "bet_sizes": [0.33], "raise_sizes": [1.0],
  "then": [
    {"line": ["c", "b33", "c"], "card": "2c"},
    {"line": ["c", "c"], "card": "9d"}
  ]
}

The answer is the flop solve, the root of the request, with a tree block for the progress of all three solves. Three solves are 3 calls. Wait until tree.status is no longer running, then read the turn and the river under the root.

Send it, wait, and read the turn and the river
jq '. + {then: [{line: ["c", "b33", "c"], card: "2c"}, {line: ["c", "c"], card: "9d"}]}' spot.json > line.json

curl -sS -X POST "$GECKO_API/v1/solves" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" -H "Prefer: wait=30" \
  -d @line.json | tee line-root.json
ROOT=$(jq -r .id line-root.json)

# the turn and the river under the root
curl -sS "$GECKO_API/v1/solves/$ROOT/children?scope=tree" -H "Authorization: Bearer $GECKO_KEY" \
  | jq '.data[] | {id, street, board, status}'

Way 3 of 3

Many lines and cards with expand

Use this whenyou want a whole street or two below a spot: all lines, with all cards or some of them.

Add expand to the spot: one level for each later street, at most two. A level says which lines of the street before it to continue, and which cards to deal.

linesdefault "all"
"all": every exit of the street before. Or a list of lines; each line is a list of steps or an exit id.
cardsdefault "all"
"all": every card that is not on the board. "distinct": one card of each group of cards that are strategically the same. Or a list of cards.
{
  "board": ["As", "Ks", "7h"], "pot": 100, "stack": 300,
  "ranges": [{"AA": 1, "AKs": 1, "QQ": 1}, {"KK": 1, "AQs": 1, "JTs": 1}],
  "bet_sizes": [0.33], "raise_sizes": [1.0],
  "expand": [
    {"lines": "all", "cards": "distinct"},
    {"lines": [["c", "c"]], "cards": ["9d", "Qs"]}
  ],
  "max_credits": 2000
}

This solves the flop, then every flop exit on every distinct turn card, then two river cards after a checked turn. Use then or expand in one request, not both.

How fast the size grows: the quick start spot

The size grows fast. For the quick start spot (5 flop exits, two-tone flop):

expandSolves, and calls
Turn: all lines, distinct cards181
Turn: all lines, all cards246
Turn and river: all lines, distinct cards18,758
Turn and river: all lines, all cards30,822

The count includes the flop. With the two default bet sizes the same flop has 7 exits: 253 solves with distinct turn cards (1 + 252), 344 with all turn cards (1 + 343), and 68,552 with every line and card of the turn and the river.

The size grows fast: each solve is one call. Ask for an estimate before you send a large request, and see how long it takes.

Distinct cards and stands_for

"cards": "distinct" solves one card of each group of cards that are strategically the same. A solve that stands for other cards lists them in stands_for.

How cards are grouped, and how to read stands_for

A flop is two-tone when two of its cards have one suit, monotone when all three have one suit, and rainbow when all three differ. Two next cards are strategically the same when a change of suits turns one into the other and changes nothing else: the flop stays the same set of cards, the turn card stays (for a river), and both starting ranges stay the same.

The solutions are then the same, with the suits renamed. "distinct" solves one card of each such group.

With ranges that treat all suits alike, a two-tone flop has 36 distinct turn cards in place of 49. A monotone flop has 23.

A rainbow flop has 49: no two turn cards are the same. A range that names single hands ("AhKh" and not "AKs") can make fewer cards equal.

A solve that stands for other cards lists them in stands_for, each with the change of suits to apply.

{
  "id": "slv_16a3bdd7ee3a029ba87f9d25",
  "street": "turn",
  "board": ["As", "Ks", "7h", "2c"],
  "card": "2c",
  "stands_for": [
    {"card": "2d", "suits": {"c": "d", "d": "c", "h": "h", "s": "s"}}
  ]
}

Read it like this: the solution for the turn 2d is this result with clubs and diamonds swapped in every hand name. AcKc in this result is AdKd on the 2d. After the change, put the two cards of a hand back in the API's order: 7c7d becomes 7d7c.

What a later street takes

A later street uses the sizes and the iterations of the street before it, unless it states its own.

The fields a parent request, a then step and an expand level can hold

A parent request, a then step and an expand level can hold the bet size fields, iterations and accuracy for their street. Besides these, a then step takes line and card, and an expand level takes lines and cards. The names of one are refused in the other.

  • A later street uses the sizes and the iterations of the street before it, unless it states its own.
  • accuracy does not carry over: state it on each turn that needs it.
  • Rake and ICM come from the first street. locks and node_actions are for the first street of a request only; in a then step or an expand level they are refused as unknown fields.

After you send a request

A request with then or expand starts many solves. Requests with many solves shows how to follow its progress, read its solves and stop it. To solve the same spot on many boards, see many boards in one request.