| array_to_strat_dict |
Ran ran; our contract draft was wrong, not the code |
google-deepmind/open_spiel/open_spiel/python/algorithms/efr.py code served (permissive licence) · get_code("a3fae536b901b362") How it ranRan 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 dict. 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 takes a strategy_array and legal_actions
# strategy_array should be array-like with values corresponding to each legal action
# legal_actions should be a list of actions
# Create a small strategy array (probabilities for each action)
strategy_array = np.array([0.2, 0.5, 0.3])
# Create a list of legal actions
legal_actions = ["action_0", "action_1", "action_2"]
ARGS = {
"strategy_array": strategy_array,
"legal_actions": legal_actions,
}
- 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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
|
| create_probs_from_index |
Ran ran; our contract draft was wrong, not the code |
google-deepmind/open_spiel/open_spiel/python/algorithms/efr.py code served (permissive licence) · get_code("654653a9b1cf7d1b") How it ranRan 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 list, 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 torch
import numpy as np
torch.manual_seed(0)
class MockPolicy:
def __init__(self):
# action_probability_array needs to be indexable
# The function accesses current_policy.action_probability_array[index[1]]
# where index[1] is an integer, and expects it to return something
# that can be passed to array_to_strat_dict as strategy_array
self.action_probability_array = [
np.array([0.2, 0.3, 0.5]),
np.array([0.1, 0.4, 0.5]),
np.array([0.6, 0.2, 0.2]),
np.array([0.25, 0.25, 0.25, 0.25])
]
# indices is a list of tuples where:
# - index[0] is legal_actions (passed to array_to_strat_dict)
# - index[1] is an index into current_policy.action_probability_array
indices = [
(["action_A", "action_B", "action_C"], 0),
(["action_X", "action_Y", "action_Z"], 1),
(["move_1", "move_2", "move_3", "move_4"], 3)
]
current_policy = MockPolicy()
ARGS = {
"indices": indices,
"current_policy": current_policy
}
- 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 list, ndim 1, dtype family float — a list 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
|
| lens |
Ran ran, honoured the contract we drafted |
google-deepmind/open_spiel/open_spiel/python/algorithms/double_oracle.py code served (permissive licence) · get_code("e893a592cd4dd8fe") How it ranRan 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 list, ndim 1, dtype family int; 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 torch
torch.manual_seed(0)
# The function lens() takes a parameter 'lists' which should be a list of lists
# and returns the length of each list. We need to provide a list of lists with
# different sizes to make the test meaningful.
ARGS = {
"lists": [
[1, 2, 3],
[4, 5],
[6, 7, 8, 9],
[]
]
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family int — a list 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
|
| max_child |
Ran ran; our contract draft was wrong, not the code |
google-deepmind/open_spiel/open_spiel/python/algorithms/async_mcts.py code served (permissive licence) · get_code("df0219b92f616df8") How it ranRan 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 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 math
class SearchNode(object):
"""A node in the search tree."""
__slots__ = ['action', 'player', 'prior', 'explore_count', 'total_reward', 'outcome', 'children', 'expanded']
def __init__(self, action: int | None, player: int, prior: float):
self.action = action
self.player = player
self.prior = prior
self.explore_count = 0
self.total_reward = 0.0
self.outcome = None
self.children = []
self.expanded = False
def uct_value(self, parent_explore_count: int, uct_c: float) -> float:
"""Returns the UCT value of child."""
if self.outcome is not None:
return self.outcome[self.player]
if self.explore_count == 0:
return float('inf')
return self.total_reward / self.explore_count + uct_c * math.sqrt(math.log(parent_explore_count) / self.explore_count)
def puct_value(self, parent_explore_count: int, uct_c: float) -> float:
"""Returns the PUCT value of child."""
if self.outcome is not None:
return self.outcome[self.player]
return (self.explore_count and self.total_reward / self.explore_count) + uct_c * self.prior * math.sqrt(parent_explore_count) / (self.explore_count + 1)
def sort_key(self):
"""Returns the best action from this node, either proven or most visited."""
return (0 if self.outcome is None else self.outcome[self.player], self.explore_count, self.total_reward)
def best_child(self):
"""Returns the best child in order of the sort key."""
return max(self.children, key=SearchNode.sort_key)
def children_str(self, state=None):
"""Returns the string representation of this node's children."""
return '\n'.join([c.to_str(state) for c in reversed(sorted(self.children, key=SearchNode.sort_key))])
def to_str(self, state=None):
"""Returns the string representation of this node."""
action = state.action_to_string(state.current_player(), self.action) if state and self.action is not None else str(self.action)
return '{:>6}: player: {}, prior: {:5.3f}, value: {:6.3f}, sims: {:5d}, outcome: {}, {:3d} children'.format(action, self.player, self.prior, self.explore_count and self.total_reward / self.explore_count, self.explore_count, '{:4.1f}'.format(self.outcome[self.player]) if self.outcome else 'none', len(self.children))
def __str__(self):
return self.to_str(None)
def max_child(root: SearchNode) -> tuple[int, SearchNode]:
"""Returns the best action and associated child node."""
selection_criteria = lambda node: node.total_reward / node.explore_count if node.explore_count else float('-inf')
best_child = max(root.children, key=selection_criteria)
return (best_child.action, best_child)
# Build root node with children
root = SearchNode(action=None, player=0, prior=1.0)
# Create child nodes with different exploration counts
child1 = SearchNode(action=0, player=1, prior=0.5)
child1.explore_count = 10
child1.total_reward = 5.0
child2 = SearchNode(action=1, player=1, prior=0.3)
child2.explore_count = 15
child2.total_reward = 9.0
child3 = SearchNode(action=2, player=1, prior=0.2)
child3.explore_count = 8
child3.total_reward = 3.0
root.children = [child1, child2, child3]
ARGS = {
'root': root
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- 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 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
|
| robust_child |
Ran ran; our contract draft was wrong, not the code |
google-deepmind/open_spiel/open_spiel/python/algorithms/async_mcts.py code served (permissive licence) · get_code("5bb2db932067db4c") How it ranRan 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 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 math
class SearchNode(object):
__slots__ = ['action', 'player', 'prior', 'explore_count', 'total_reward', 'outcome', 'children', 'expanded']
def __init__(self, action: int | None, player: int, prior: float):
self.action = action
self.player = player
self.prior = prior
self.explore_count = 0
self.total_reward = 0.0
self.outcome = None
self.children = []
self.expanded = False
def uct_value(self, parent_explore_count: int, uct_c: float) -> float:
if self.outcome is not None:
return self.outcome[self.player]
if self.explore_count == 0:
return float('inf')
return self.total_reward / self.explore_count + uct_c * math.sqrt(math.log(parent_explore_count) / self.explore_count)
def puct_value(self, parent_explore_count: int, uct_c: float) -> float:
if self.outcome is not None:
return self.outcome[self.player]
return (self.explore_count and self.total_reward / self.explore_count) + uct_c * self.prior * math.sqrt(parent_explore_count) / (self.explore_count + 1)
def sort_key(self):
return (0 if self.outcome is None else self.outcome[self.player], self.explore_count, self.total_reward)
def best_child(self):
return max(self.children, key=SearchNode.sort_key)
def children_str(self, state=None):
return '\n'.join([c.to_str(state) for c in reversed(sorted(self.children, key=SearchNode.sort_key))])
def to_str(self, state=None):
action = state.action_to_string(state.current_player(), self.action) if state and self.action is not None else str(self.action)
return '{:>6}: player: {}, prior: {:5.3f}, value: {:6.3f}, sims: {:5d}, outcome: {}, {:3d} children'.format(action, self.player, self.prior, self.explore_count and self.total_reward / self.explore_count, self.explore_count, '{:4.1f}'.format(self.outcome[self.player]) if self.outcome else 'none', len(self.children))
def __str__(self):
return self.to_str(None)
def robust_child(root: SearchNode) -> tuple[int, SearchNode]:
selection_criteria = lambda node: node.explore_count
best_child = max(root.children, key=selection_criteria)
return (best_child.action, best_child)
# Create a root node with some children
root = SearchNode(action=None, player=0, prior=1.0)
# Create child nodes with different explore counts
child1 = SearchNode(action=0, player=1, prior=0.3)
child1.explore_count = 5
child1.total_reward = 2.5
child2 = SearchNode(action=1, player=1, prior=0.4)
child2.explore_count = 10
child2.total_reward = 5.0
child3 = SearchNode(action=2, player=1, prior=0.3)
child3.explore_count = 3
child3.total_reward = 1.2
root.children = [child1, child2, child3]
ARGS = {
'root': root
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- 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 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
|
| robust_child_with_total_reward_tiebreaker |
Ran ran; our contract draft was wrong, not the code |
google-deepmind/open_spiel/open_spiel/python/algorithms/async_mcts.py code served (permissive licence) · get_code("7fdee38eaebea0d2") How it ranRan 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 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 math
class SearchNode(object):
__slots__ = ['action', 'player', 'prior', 'explore_count', 'total_reward', 'outcome', 'children', 'expanded']
def __init__(self, action: int | None, player: int, prior: float):
self.action = action
self.player = player
self.prior = prior
self.explore_count = 0
self.total_reward = 0.0
self.outcome = None
self.children = []
self.expanded = False
def uct_value(self, parent_explore_count: int, uct_c: float) -> float:
if self.outcome is not None:
return self.outcome[self.player]
if self.explore_count == 0:
return float('inf')
return self.total_reward / self.explore_count + uct_c * math.sqrt(math.log(parent_explore_count) / self.explore_count)
def puct_value(self, parent_explore_count: int, uct_c: float) -> float:
if self.outcome is not None:
return self.outcome[self.player]
return (self.explore_count and self.total_reward / self.explore_count) + uct_c * self.prior * math.sqrt(parent_explore_count) / (self.explore_count + 1)
def sort_key(self):
return (0 if self.outcome is None else self.outcome[self.player], self.explore_count, self.total_reward)
def best_child(self):
return max(self.children, key=SearchNode.sort_key)
def children_str(self, state=None):
return '\n'.join([c.to_str(state) for c in reversed(sorted(self.children, key=SearchNode.sort_key))])
def to_str(self, state=None):
action = state.action_to_string(state.current_player(), self.action) if state and self.action is not None else str(self.action)
return '{:>6}: player: {}, prior: {:5.3f}, value: {:6.3f}, sims: {:5d}, outcome: {}, {:3d} children'.format(action, self.player, self.prior, self.explore_count and self.total_reward / self.explore_count, self.explore_count, '{:4.1f}'.format(self.outcome[self.player]) if self.outcome else 'none', len(self.children))
def __str__(self):
return self.to_str(None)
def robust_child_with_total_reward_tiebreaker(root: SearchNode) -> tuple[int, SearchNode]:
selection_criteria = lambda node: (node.explore_count, node.total_reward)
best_child = max(root.children, key=selection_criteria)
return (best_child.action, best_child)
# Create a root node with children
root = SearchNode(action=None, player=0, prior=1.0)
# Create child nodes with different explore counts and total rewards
child1 = SearchNode(action=0, player=1, prior=0.5)
child1.explore_count = 10
child1.total_reward = 5.0
child2 = SearchNode(action=1, player=1, prior=0.3)
child2.explore_count = 10
child2.total_reward = 7.0
child3 = SearchNode(action=2, player=1, prior=0.2)
child3.explore_count = 5
child3.total_reward = 3.0
root.children = [child1, child2, child3]
ARGS = {
"root": root
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- 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 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
|
| strat_dict_to_array |
Ran ran, honoured the contract we drafted |
google-deepmind/open_spiel/open_spiel/python/algorithms/efr.py code served (permissive licence) · get_code("7f99b0a7ffd18410") How it ranRan 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 ndarray, ndim 2, dtype family float, shape (4, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 numpy as np
# Create a simple strategy dictionary with action -> probability mappings
strategy_dictionary = {
0: 0.1,
1: 0.3,
2: 0.4,
3: 0.2
}
ARGS = {
"strategy_dictionary": strategy_dictionary
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (4, 1) — shape (4, 1) as a later run recorded it
- 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
|