SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.06426 · NeurIPS · 2021

XDO: A Double Oracle Algorithm for Extensive-Form Games

Stephen Mcaleer, John Lanier, Kevin Wang, Pierre Baldi, Roy Fox

arXiv · PDF · Open in the Atlas

Code that ran

5 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 4 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2103.06426.json · badge: /api/ran/2103.06426.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
indylab/nxdo canonical (classifier label)
classifier basis: classifier_2025
4 ran · 4 no recorded run
indylab/tabular_xdo canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
SafeFallbackJSONEncoder Ran
ran on a synthesized input
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("ff24c0265ef0bddd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import numbers
import numpy as np

class SafeFallbackJSONEncoder(json.JSONEncoder):

    def __init__(self, nan_str='null', **kwargs):
        super(SafeFallbackJSONEncoder, self).__init__(**kwargs)
        self.nan_str = nan_str

    def default(self, value):
        try:
            if np.isnan(value):
                return self.nan_str
            if type(value).__module__ == np.__name__ and isinstance(value, np.ndarray):
                return value.tolist()
            if issubclass(type(value), numbers.Integral):
                return int(value)
            if issubclass(type(value), numbers.Number):
                return float(value)
            return super(SafeFallbackJSONEncoder, self).default(value)
        except Exception:
            return str(value)


INIT_ARGS = {
    'nan_str': 'NaN'
}

ARGS = {
    'value': np.float64('nan')
}

METHOD = 'default'

if __name__ == '__main__':
    encoder = SafeFallbackJSONEncoder(**INIT_ARGS)
    result = encoder.default(**ARGS)
    print(f"Result: {result}")
    
    encoder2 = SafeFallbackJSONEncoder(nan_str='null')
    result2 = encoder2.default(np.array([1.0, 2.0, 3.0]))
    print(f"Array result: {result2}")
    
    result3 = encoder2.default(42)
    print(f"Int result: {result3}")
    
    result4 = encoder2.default(3.14)
    print(f"Float result: {result4}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
StrategySpec Ran
ran on a synthesized input
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("8ee2503f180b5135")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import numpy as np
from typing import List, Tuple, Union, Dict
import numbers

class SafeFallbackJSONEncoder(json.JSONEncoder):

    def __init__(self, nan_str='null', **kwargs):
        super(SafeFallbackJSONEncoder, self).__init__(**kwargs)
        self.nan_str = nan_str

    def default(self, value):
        try:
            if np.isnan(value):
                return self.nan_str
            if type(value).__module__ == np.__name__ and isinstance(value, np.ndarray):
                return value.tolist()
            if issubclass(type(value), numbers.Integral):
                return int(value)
            if issubclass(type(value), numbers.Number):
                return float(value)
            return super(SafeFallbackJSONEncoder, self).default(value)
        except Exception:
            return str(value)

def check_if_jsonable(check_dict) -> Tuple[bool, Union[Exception, None]]:
    try:
        json.dumps(check_dict, cls=SafeFallbackJSONEncoder)
    except (TypeError, OverflowError) as json_err:
        return (False, json_err)
    return (True, None)

class StrategySpec(object):

    def __init__(self, strategy_id: str, metadata: dict, pure_strategy_indexes=None):
        if metadata is None:
            metadata = {}
        if not isinstance(strategy_id, str):
            raise ValueError('strategy_id is not of type string.')
        is_jsonable, json_err = check_if_jsonable(check_dict=metadata)
        if not is_jsonable:
            raise ValueError(f'Metadata is not JSON serializable. All metadata values need to be JSON serializable.\nJSON error is:\n{json_err}')
        if pure_strategy_indexes is not None:
            for player, index in pure_strategy_indexes.items():
                if not isinstance(player, int) and player >= 0:
                    raise ValueError('Keys in pure_strategy_indexes must be player numbers (ints) >= 0')
                if not isinstance(index, int) and index >= 0:
                    raise ValueError('Values in pure_strategy_indexes must be strategy indexes (ints) >= 0')
        self.id = strategy_id
        self.metadata = metadata
        self._pure_strategy_indexes = pure_strategy_indexes if pure_strategy_indexes is not None else {}

    def assign_pure_strat_index(self, player, pure_strat_index):
        if self._pure_strategy_indexes.get(player) is not None:
            raise ValueError('Cannot assign a new pure strategy index when one is already assigned for the same player.')
        self._pure_strategy_indexes[player] = pure_strat_index

    def pure_strat_index_for_player(self, player):
        return self._pure_strategy_indexes[player]

    def get_pure_strat_indexes(self):
        return self._pure_strategy_indexes.copy()

    def update_metadata(self, new_metadata):
        if new_metadata is not None:
            self.metadata.update(new_metadata)

    def serialize_to_dict(self):
        return {'id': self.id, 'metadata': self.metadata, 'pure_strategy_indexes': self.get_pure_strat_indexes()}

    def to_json(self):
        return json.dumps(self.serialize_to_dict())

    @classmethod
    def from_dict(cls, serialized_dict: dict):
        spec = StrategySpec(strategy_id=serialized_dict['id'], metadata=serialized_dict['metadata'])
        for player, index in serialized_dict['pure_strategy_indexes'].items():
            spec.assign_pure_strat_index(player=int(player), pure_strat_index=int(index))
        return spec

    @classmethod
    def from_json(cls, json_string: str):
        return StrategySpec.from_dict(json.loads(s=json_string))

    @classmethod
    def from_json_file(cls, json_file_path: str):
        with open(json_file_path, 'r') as json_file:
            spec_json = json.load(json_file)
            return StrategySpec.from_dict(spec_json)

    def __eq__(self, other):
        if not isinstance(other, StrategySpec):
            return False
        return self.to_json() == other.to_json()

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        return self.to_json().__hash__()


INIT_ARGS = {
    'strategy_id': 'strategy_001',
    'metadata': {
        'player_count': 2,
        'game_type': 'normal_form',
        'payoff': 3.14,
        'description': 'test strategy'
    },
    'pure_strategy_indexes': {0: 1, 1: 2}
}

ARGS = {
    'new_metadata': {'updated_field': 'new_value', 'score': 42}
}

METHOD = 'update_metadata'

spec = StrategySpec(**INIT_ARGS)
print("Created StrategySpec:")
print(f"  ID: {spec.id}")
print(f"  Metadata: {spec.metadata}")
print(f"  Pure Strategy Indexes: {spec.get_pure_strat_indexes()}")

spec.update_metadata(**ARGS)
print("\nAfter update_metadata:")
print(f"  Metadata: {spec.metadata}")

serialized = spec.serialize_to_dict()
print("\nSerialized:")
print(f"  {serialized}")

json_str = spec.to_json()
print("\nJSON representation:")
print(f"  {json_str}")

spec2 = StrategySpec.from_json(json_str)
print("\nDeserialized from JSON:")
print(f"  Equal to original: {spec == spec2}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
check_if_jsonable Ran
ran; our contract draft was wrong, not the code
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("c0b3a0e916709ae1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
from typing import List, Tuple, Union, Dict
import numbers
import numpy as np

class SafeFallbackJSONEncoder(json.JSONEncoder):

    def __init__(self, nan_str='null', **kwargs):
        super(SafeFallbackJSONEncoder, self).__init__(**kwargs)
        self.nan_str = nan_str

    def default(self, value):
        try:
            if np.isnan(value):
                return self.nan_str
            if type(value).__module__ == np.__name__ and isinstance(value, np.ndarray):
                return value.tolist()
            if issubclass(type(value), numbers.Integral):
                return int(value)
            if issubclass(type(value), numbers.Number):
                return float(value)
            return super(SafeFallbackJSONEncoder, self).default(value)
        except Exception:
            return str(value)

def check_if_jsonable(check_dict) -> Tuple[bool, Union[Exception, None]]:
    try:
        json.dumps(check_dict, cls=SafeFallbackJSONEncoder)
    except (TypeError, OverflowError) as json_err:
        return (False, json_err)
    return (True, None)

# Test case 1: Simple jsonable dict
test_dict_1 = {
    "name": "test",
    "value": 42,
    "float_val": 3.14,
    "list": [1, 2, 3],
    "nested": {"key": "value"}
}

# Test case 2: Dict with numpy types
test_dict_2 = {
    "np_int": np.int64(100),
    "np_float": np.float32(2.71),
    "np_array": np.array([1, 2, 3]),
    "np_nan": np.nan,
    "regular_int": 5,
    "regular_float": 1.5
}

# Test case 3: Dict with mixed types including edge cases
test_dict_3 = {
    "string": "hello",
    "integer": 999,
    "float": 0.5,
    "bool": True,
    "none": None,
    "list_of_nums": [1, 2.5, np.int32(3)],
    "nested_dict": {
        "inner_nan": np.nan,
        "inner_array": np.array([[1, 2], [3, 4]])
    }
}

ARGS = {
    "check_dict": test_dict_2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
datetime_str Ran
ran on a synthesized input
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("ffff3a51188e0637")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import datetime

def datetime_str():
    date_string = datetime.datetime.now().strftime('%I.%M.%S%p_%b-%d-%Y')
    return date_string

ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
policy_class_instance_to_full_policy Ran
ran; our contract draft was wrong, not the code
indylab/tabular_xdo/xdo_psro_fixed_population_comparison.py
code served (permissive licence) · get_code("d29981ec0da3193d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockState:
    def __init__(self):
        self._current_player = 0
    
    def current_player(self):
        return self._current_player

class MockPolicyClass:
    def action_probabilities(self, state, player_id):
        # Return a dict mapping actions to probabilities
        return {
            0: 0.3,
            1: 0.5,
            2: 0.2
        }

policy_instance = MockPolicyClass()

ARGS = {
    "policy_class_instance": policy_instance
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
NXDOManager Not yet run
unverified (harvested, no recorded run)
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("83aab9bc5f690c88")
How it ran

no invocation recorded.

RestrictedGameSolveResult Not yet run
unverified (harvested, no recorded run)
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("40e9050b70dc2e70")
How it ran

no invocation recorded.

SolveRestrictedGame Not yet run
unverified (harvested, no recorded run)
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("e82865b6d2eed8be")
How it ran

no invocation recorded.

ensure_dir Not yet run
unverified (harvested, no recorded run)
indylab/nxdo/grl/algos/nxdo/nxdo_manager/manager.py
code served (permissive licence) · get_code("c670869610afca4c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Policy Space Response Oracles (PSRO) is a reinforcement learning (RL) algorithm for two-player zero-sum games that has been empirically shown to find approximate Nash equilibria in large games. Although PSRO is guaranteed to converge to an approximate Nash equilibrium and can handle continuous actions, it may take an exponential number of iterations as the number of information states (infostates) grows. We propose Extensive-Form Double Oracle (XDO), an extensive-form double oracle algorithm for two-player zero-sum games that is guaranteed to converge to an approximate Nash equilibrium linearly in the number of infostates. Unlike PSRO, which mixes best responses at the root of the game, XDO mixes best responses at every infostate. We also introduce Neural XDO (NXDO), where the best response is learned through deep RL. In tabular experiments on Leduc poker, we find that XDO achieves an approximate Nash equilibrium in a number of iterations an order of magnitude smaller than PSRO. Experiments on a modified Leduc poker game and Oshi-Zumo show that tabular XDO achieves a lower exploitability than CFR with the same amount of computation. We also find that NXDO outperforms PSRO and NFSP on a sequential multidimensional continuous-action game. NXDO is the first deep RL method that can find an approximate Nash equilibrium in high-dimensional continuous-action sequential games. Experiment code is available at https://github.com/indylab/nxdo.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2103.06426")
get_code_for_paper("2103.06426")
have("2103.06426")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2103.06426.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2103.06426.svg)](https://syntology.ai/paper/2103.06426)

Connect an agent — have() is free.