mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-28 17:29:39 +00:00
Game of Life partial scoring and rule-clarification (#258)
* partial scoring and rule clarification * better ql scoring * word seq reverse typos
This commit is contained in:
parent
340d6a7ab9
commit
e3b7365f50
4 changed files with 60 additions and 9 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from reasoning_gym.algorithmic.game_of_life import GameOfLifeConfig, GameOfLifeDataset
|
||||
|
|
@ -50,6 +52,24 @@ def test_game_of_life_basic_properties():
|
|||
assert dataset.score_answer(answer=None, entry=item) == 0.0
|
||||
assert dataset.score_answer(answer="invalid json", entry=item) == 0.01
|
||||
|
||||
config = GameOfLifeConfig(seed=43, size=1, grid_size_x=3, grid_size_y=3, filled_cells=1, simulation_steps=1)
|
||||
dataset = GameOfLifeDataset(config)
|
||||
|
||||
for item in dataset:
|
||||
assert isinstance(item, dict)
|
||||
assert "question" in item
|
||||
assert "answer" in item
|
||||
assert "metadata" in item
|
||||
|
||||
ja = json.loads(item["answer"])
|
||||
ja[0][0] = 1
|
||||
ja[0][1] = 1
|
||||
ja[0][2] = 1
|
||||
jas = json.dumps(ja)
|
||||
|
||||
# Test the scoring
|
||||
assert 0.1 < dataset.score_answer(answer=jas, entry=item) < 1.0
|
||||
|
||||
|
||||
def test_game_of_life_iteration():
|
||||
"""Test that iteration respects dataset size"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue