Solving

Results

A result is the solution of one street: every decision, and for each hand at it the strategy, the EV and the weight. This page shows how to read it.

In short

  • A result is one JSON document for one street. It can be large: ask for gzip.
  • Each decision has actions, and for each hand a strategy, evs and a range weight, in the order of actions.
  • Find a node by its node_id. A hand, a node or an exit that no hand reaches can be absent.
  • A result can be read for 6 days. A complete real result is here: sample-result.json.
The download: its size, gzip and the sample file

GET /v1/solves/{id}/result returns the solution of one street as one JSON document. It is large: from a few hundred kilobytes for narrow ranges to 16 MiB at most.

Ask for gzip (curl --compressed; most HTTP libraries do it for you). To read one decision without the whole document, use the node routes.

A complete real result is here to build your parser against: sample-result.json (228 KB). It is the result of the quick start flop with a live key: board As Ks 7h, pot 100, stack 300, one bet size of 33%.

The examples below come from it. A test key gives the same format with placeholder numbers.

Read the strategy of one hand

Take AhKh, the ace and king of hearts, at the first decision. Put the three lists side by side.

A♥︎K♥︎
AhKh at r:0Out of position, first to act. The hand has weight 1.0 in the range.
ActionactionsstrategyPlaysevs
All-in (300)b3000.0001<0.1%104.66
Bet 33b330.783278.3%130.85
Checkc0.216721.7%130.94

The hand bets 33 chips 78% of the time and checks 22%. Both actions are worth about 131 chips: a hand that mixes has close to the same EV for each action it plays. The all-in is worth 26 chips less, so the hand does not play it.

# the first decision
jq '.tree.strategy | {actions, plays: .strategy.AhKh, evs: .evs.AhKh, weight: .range.AhKh}' flop-result.json

# any decision, found by its node id; null when the node or the hand is not there
jq --arg id "r:0:c:b33" --arg hand "AhKh" '
  [.tree | recurse(.childrens[]?) | select(.node_id == $id)][0].strategy
  | if . == null or (.strategy[$hand] == null) then null
    else {actions, plays: .strategy[$hand], evs: .evs[$hand], weight: .range[$hand]} end' flop-result.json

# live key:  actions ["b300","b199","c","f"]  plays [0.0014, 0.0100, 0.9886, 0.0000]  weight 0.2167
# test key:  actions ["b300","b199","c","f"]  plays [0.25, 0.25, 0.25, 0.25]          weight 1
After the first decision, and the mix of a whole range

After check and a bet of 33, the hand is at r:0:c:b33 with weight 0.2167: it gets there only when it checked. The samples below answer “what does this hand do at this decision” and return nothing, without an error, when the node or the hand is not in the result.

To get the mix of a whole range or of a hand class at a decision, weight each hand by its range value there: the sum of range × strategy over the hands, divided by the sum of range.

Look it up

A decision in the result

actions, strategy, evs, range

tree is the first decision of the street. Each node has the next nodes in childrens, a map from an action to the node after that action. Every field of the document is in the result format.

The strategy block of a decision has four parts.

actions
The names of the actions at this decision. The lists below follow this order. Do not assume an order: read it.
strategy
For each hand, the probability of each action. A row adds up to 1.
evs
For each hand, the EV of each action in chips: what the hand gets back at the end, minus the chips it puts in from this decision on. A fold is 0.
range
For each hand, the weight with which it arrives at this decision: its starting weight times the probabilities of the player's own earlier actions on this street.

A decision lists the hands the deciding player can hold there. In the example that is 88 hands out of position and 104 in position at the first decisions.

Find a node by its node_id, not by building the id from action names.

On a flop result the action names are the tokens of the node id. On a turn or river result, a raise by a player who already has chips in on the street is named in actions and childrens by the chips it adds, and in the node id by the total: after a bet of 33 and a raise to 199, the all-in to 300 is the action b267 and leads to the node r:0:c:b33:b199:b300.

One decision without the whole result

the node routes

Two routes read a result in parts, without the download of the whole document. Both work with a test key.

GET /v1/solves/{id}/nodes lists every node: its node_id, type, pot and, at a decision, actions. There are four types. OOP_DEC: the out-of-position player decides.

IP_DEC: the in-position player decides. SPLIT_NODE: the street ends and a card comes; this is an exit.

END_NODE: the hand ends, by a fold or at showdown. More in the result format.

The list of nodes (part)
{
  "data": [
    {"node_id": "r:0", "type": "OOP_DEC", "pot": 100, "actions": ["b300", "b33", "c"]},
    {"node_id": "r:0:c", "type": "IP_DEC", "pot": 100, "actions": ["b300", "b33", "c"]},
    {"node_id": "r:0:c:c", "type": "SPLIT_NODE", "pot": 100},
    {"node_id": "r:0:b300:c", "type": "END_NODE", "pot": 700}
  ]
}

GET /v1/solves/{id}/nodes/{node_id} returns one node. At a decision it has every hand with its weight, its strategy and its EVs, and children: the node id after each action. Add ?hands= with a list of hands and hand classes to get only those: AhKh, AKs, AKo, AA.

A hand can have its two cards in either order: KhAh is AhKh. A hand that is not at the node is left out. A name that is not a hand or a hand class is refused with 422 invalid_request.

curl -sS "$GECKO_API/v1/solves/$FLOP/nodes" -H "Authorization: Bearer $GECKO_KEY" | jq '.data | length'

curl -sS "$GECKO_API/v1/solves/$FLOP/nodes/r:0:c:b33?hands=AKs,QhQd" \
  -H "Authorization: Bearer $GECKO_KEY"
The answer, with a live key
{
  "node_id": "r:0:c:b33",
  "type": "OOP_DEC",
  "pot": 133,
  "actions": ["b300", "b199", "c", "f"],
  "children": {"b300": "r:0:c:b33:b300", "b199": "r:0:c:b33:b199", "c": "r:0:c:b33:c", "f": "r:0:c:b33:f"},
  "hands": {
    "QhQd": {"range": 0.6631, "strategy": [0.0000, 0.0000, 0.9999, 0.0001], "evs": [-13.69, -1.18, 7.97, 0.0]},
    "AcKc": {"range": 0.1071, "strategy": [0.2680, 0.5603, 0.1717, 0.0000], "evs": [145.81, 148.89, 145.07, 0.0]},
    "AdKd": {"range": 0.1071, "strategy": [0.2680, 0.5603, 0.1717, 0.0000], "evs": [145.81, 148.89, 145.07, 0.0]},
    "AhKh": {"range": 0.2167, "strategy": [0.0014, 0.0100, 0.9886, 0.0000], "evs": [143.04, 153.90, 158.27, 0.0]}
  }
}

AKs gives three hands here, not four: the ace and the king of spades are on the board. A node id that the result does not have is 404 no_such_node.

What a result can leave out

Write your reading code so that a missing key is normal.

  • A hand with weight zero at a decision is not listed there. It is absent from strategy, evs and range. A hand that never takes the line to a decision is not at that decision.
  • A decision that no hand reaches has empty maps and an empty childrens: there are no nodes under it.
  • An exit that no hand of one of the players reaches is not in exits. You cannot continue from it.
  • A decision with locked hands lists them in strategy.locked. A decision that a lock makes unreachable has "unreached": true.
  • A result above 16 MiB fails the solve. The solve is failed with the code solver_failed and is not charged. Use fewer bet and raise sizes, fewer raises, or narrower ranges.

When a result can be read

  • A solve that is not complete has no result: 409 not_ready, with solve_status.
  • A result can be read for 6 days after its solve finished. After expires_at the answer is 410 expired, and the solve cannot be a parent. A solve in a list can still show result after that time.
  • A solve can stop being a parent before its 6 days end, after a solver update: see step by step. Its result can still be read.
  • Keep the results you need, with the solve id, the model_id and your request. You can keep them for your own users: see Fair use.