Changed params in knight_swap and make some clean up

This commit is contained in:
abdulhakeem 2025-04-03 09:10:48 -05:00
parent 29ec970044
commit bf9d3b9bab
2 changed files with 2 additions and 4 deletions

View file

@ -51,8 +51,8 @@ class KnightSwapConfig:
max_nodes: int = 9 # Maximum number of squares on the board
min_pieces: int = 2 # Minimum number of pieces per color
max_pieces: int = 2 # Maximum number of pieces per color
min_steps: int = 3 # Minimum solution length
max_steps: int = 5 # Maximum solution length
min_steps: int = 4 # Minimum solution length
max_steps: int = 20 # Maximum solution length
max_attempts: int = 50 # Maximum attempts for board generation and puzzle creation
seed: Optional[int] = None
size: int = 5 # Virtual dataset size

View file

@ -116,10 +116,8 @@ class Puzzle24Dataset(ProceduralDataset):
try:
answer = answer.strip()
user_answer = int(parse_expr(answer))
print(f"User answer: {user_answer}")
solved = user_answer == 24
used_numbers = [int(num) for num in re.findall(r"\b\d+\b", answer)]
print(f"Used numbers: {used_numbers}")
if len(used_numbers) != 4:
reward = 0.01
elif any(num > self.config.max_value or num < self.config.min_value for num in used_numbers):