mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2025-10-09 13:40:09 +03:00
fix dice
This commit is contained in:
@@ -75,14 +75,14 @@ def generate_puzzle(num_dice, max_dice_size, rng):
|
|||||||
high_target = min_total + 2 * (max_total - min_total) // 3
|
high_target = min_total + 2 * (max_total - min_total) // 3
|
||||||
target = rng.randint(low_target, high_target)
|
target = rng.randint(low_target, high_target)
|
||||||
|
|
||||||
# Compute probability.
|
# Compute probability. Don't change this.
|
||||||
(num, den) = compute_probability(dice, target)
|
(num, den), probability = compute_probability(dice, target)
|
||||||
|
|
||||||
# Create a string representing the dice, e.g., "1d20, 1d17, 1d6" etc.
|
# Create a string representing the dice, e.g., "1d20, 1d17, 1d6" etc.
|
||||||
dice_str = ", ".join(f"1d{s}" for s in dice)
|
dice_str = ", ".join(f"1d{s}" for s in dice)
|
||||||
|
|
||||||
# Return the puzzle.
|
# Return the puzzle.
|
||||||
return {"dice_str": dice_str, "target": target, "num": num, "den": den}
|
return {"dice_str": dice_str, "target": target, "num": num, "den": den, "probability": probability}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -127,7 +127,8 @@ class DiceDataset(ProceduralDataset):
|
|||||||
"difficulty": {
|
"difficulty": {
|
||||||
"num_dice": self.config.num_dice,
|
"num_dice": self.config.num_dice,
|
||||||
"max_dice_size": self.config.max_dice_size,
|
"max_dice_size": self.config.max_dice_size,
|
||||||
}
|
},
|
||||||
|
"puzzle": puzzle,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user