mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Move make_impossible decision before the retry loop so it's fixed per item instead of re-rolled on every attempt, which skewed the actual ratio of impossible puzzles well above the configured value.
This commit is contained in:
parent
49b1dbbcce
commit
d26663fb3f
1 changed files with 3 additions and 3 deletions
|
|
@ -219,6 +219,9 @@ class KnightSwapDataset(ProceduralDataset):
|
||||||
"""Generate a single Knight Swap puzzle."""
|
"""Generate a single Knight Swap puzzle."""
|
||||||
rng = Random(self.seed + idx)
|
rng = Random(self.seed + idx)
|
||||||
|
|
||||||
|
# Decide if this should be an impossible puzzle (fixed per item, not per attempt)
|
||||||
|
make_impossible = rng.random() < self.config.impossible_ratio
|
||||||
|
|
||||||
# Keep trying with new boards until we succeed
|
# Keep trying with new boards until we succeed
|
||||||
board_attempts = 0
|
board_attempts = 0
|
||||||
while board_attempts < self.config.max_attempts:
|
while board_attempts < self.config.max_attempts:
|
||||||
|
|
@ -228,9 +231,6 @@ class KnightSwapDataset(ProceduralDataset):
|
||||||
board = self.game_logic.generate_board(num_nodes, rng, max_attempts=self.config.max_attempts)
|
board = self.game_logic.generate_board(num_nodes, rng, max_attempts=self.config.max_attempts)
|
||||||
positions = list(board.keys())
|
positions = list(board.keys())
|
||||||
|
|
||||||
# Decide if this should be an impossible puzzle
|
|
||||||
make_impossible = rng.random() < self.config.impossible_ratio
|
|
||||||
|
|
||||||
# Try different piece placements on this board
|
# Try different piece placements on this board
|
||||||
for _ in range(50): # Reduced attempts per board since we try multiple boards
|
for _ in range(50): # Reduced attempts per board since we try multiple boards
|
||||||
# Use fixed number of pieces for more reliable generation
|
# Use fixed number of pieces for more reliable generation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue