mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
update instruction and shuffle numbers
This commit is contained in:
parent
7273ebb590
commit
18cf71a4a7
1 changed files with 2 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ QUESTION_TEMPLATE = """Given a square matrix, your job is to find the distance o
|
|||
|
||||
Example:
|
||||
|
||||
Input: Rotate the matrix below by 90 degrees clockwise:
|
||||
Input: Find the distance to the nearest 0 for each cell in the matrix below:
|
||||
0 0 0
|
||||
0 1 0
|
||||
1 1 1
|
||||
|
|
@ -58,6 +58,7 @@ class BinaryMatrixDataset(ProceduralDataset):
|
|||
n = rng.randint(1, self.config.max_n)
|
||||
# Ensure at least one 0 in the matrix, so that a solution exists
|
||||
numbers = [0] + [0 if rng.random() < self.config.p_zero else 1 for _ in range(n**2 - 1)]
|
||||
rng.shuffle(numbers)
|
||||
matrix = [numbers[i * n : (i + 1) * n] for i in range(n)]
|
||||
return matrix
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue