SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.13710 · 2020

Generating and Adapting to Diverse Ad-Hoc Cooperation Agents in Hanabi

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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, 2 violated it and 0 have no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2004.13710.json · badge: /api/ran/2004.13710.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
rocanaan/hanabi-ad-hoc-learning community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
color_idx_to_char Ran
ran; our contract draft was wrong, not the code
rocanaan/hanabi-ad-hoc-learning/pyhanabi.py
code served (permissive licence) · get_code("e8b86475e9cc43ba")
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, through the batch API) 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 torch
import numpy as np

torch.manual_seed(0)

# The function color_idx_to_char takes a single parameter: color_idx
# which should be an int. Looking at the function body:
# - It checks isinstance(color_idx, int)
# - It handles color_idx == -1 returning None
# - Otherwise it indexes into COLOR_CHAR list with color_idx
# COLOR_CHAR has 5 elements (indices 0-4)

# Valid test cases would be:
# - A valid index: 0, 1, 2, 3, or 4
# - The special case: -1

ARGS = {
    'color_idx': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
try_cdef Ran
ran, violated the contract we drafted
rocanaan/hanabi-ad-hoc-learning/pyhanabi.py
code served (permissive licence) · get_code("66eb94ec1e1467ae")
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, through the batch API) and returned bool, ndim 0, 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 os
import re
import tempfile

# Create a temporary directory and a mock header file
temp_dir = tempfile.mkdtemp()
header_file = os.path.join(temp_dir, 'pyhanabi.h')

# Write a minimal valid C header with extern "C" block
header_content = '''#ifndef PYHANABI_H
#define PYHANABI_H

extern "C" {
    int sample_function(int x);
    void another_function(float y);
}/* extern "C" */

#endif
'''

with open(header_file, 'w') as f:
    f.write(header_content)

# Define arguments for try_cdef function
ARGS = {
    'header': 'pyhanabi.h',
    'prefixes': (None, temp_dir, '.', '/include')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cffi — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:NameError)
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
try_load Ran
ran, violated the contract we drafted
rocanaan/hanabi-ad-hoc-learning/pyhanabi.py
code served (permissive licence) · get_code("6ea5a7ed1e5d87a8")
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, through the batch API) and returned bool, ndim 0, 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 os
import sys
from unittest.mock import Mock, MagicMock

# Mock cffi since it's an external library
sys.modules['cffi'] = MagicMock()

# Define __file__ for the module context
__file__ = '/mock/path/to/module.py'

# Create mock ffi object
ffi = MagicMock()
ffi.dlopen = MagicMock(side_effect=OSError("Library not found"))

# Define constants that would normally be in the module
DEFAULT_LIB_PREFIXES = (None, '.', os.path.dirname(__file__), '/lib')
PYHANABI_LIB = ['libpyhanabi.so', 'libpyhanabi.dylib']

# Initialize global state
lib_loaded_flag = False
lib = None

# Define the function
def try_load(library=None, prefixes=DEFAULT_LIB_PREFIXES):
    """Try loading library. Must be called before any pyhanabi calls.

    Args:
      library: filename of pyhanabi library file.
      prefixes: list of paths to search for pyhanabi library file.
    Returns:
      True if library was successfully loaded, False on failure.
    """
    global lib_loaded_flag
    global lib
    if lib_loaded_flag:
        return True
    if library is None:
        libnames = PYHANABI_LIB
    elif type(library) in (list, tuple):
        libnames = library
    else:
        libnames = (library,)
    for prefix in prefixes:
        for libname in libnames:
            try:
                lib_file = libname if prefix is None else prefix + '/' + libname
                lib = ffi.dlopen(lib_file)
                lib_loaded_flag = True
                return True
            except OSError:
                pass
    return False

# Create valid arguments for the function
ARGS = {
    'library': None,
    'prefixes': (None, '.', '/mock/path/to', '/lib')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cffi — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:NameError)
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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 0 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.

FunctionAlso present inEarliest-datedOthers named
color_idx_to_char 1 other paper
1 later
2308.10284 (2023-08)
Towards Few-shot Coordination: Revisiting Ad-hoc Teamplay Challenge In the Game of Hanabi
try_cdef 1 other paper
1 later
2308.10284 (2023-08)
Towards Few-shot Coordination: Revisiting Ad-hoc Teamplay Challenge In the Game of Hanabi
try_load 1 other paper
1 later
2308.10284 (2023-08)
Towards Few-shot Coordination: Revisiting Ad-hoc Teamplay Challenge In the Game of Hanabi

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

Hanabi is a cooperative game that brings the problem of modeling other players to the forefront. In this game, coordinated groups of players can leverage pre-established conventions to great effect, but playing in an ad-hoc setting requires agents to adapt to its partner's strategies with no previous coordination. Evaluating an agent in this setting requires a diverse population of potential partners, but so far, the behavioral diversity of agents has not been considered in a systematic way. This paper proposes Quality Diversity algorithms as a promising class of algorithms to generate diverse populations for this purpose, and generates a population of diverse Hanabi agents using MAP-Elites. We also postulate that agents can benefit from a diverse population during training and implement a simple "meta-strategy" for adapting to an agent's perceived behavioral niche. We show this meta-strategy can work better than generalist strategies even outside the population it was trained with if its partner's behavioral niche can be correctly inferred, but in practice a partner's behavior depends and interferes with the meta-agent's own behavior, suggesting an avenue for future research in characterizing another agent's behavior during gameplay.

For agents

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

get_harvested_code_for_paper("2004.13710")
get_code_for_paper("2004.13710")
have("2004.13710")

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

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

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

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

Connect an agent — have() is free.