Skip to content

Commit 29f071e

Browse files
committed
Added some basic and trivial inverse puzzles
Made code to reproduce prompts
1 parent f763d5f commit 29f071e

File tree

10 files changed

+37785
-3000
lines changed

10 files changed

+37785
-3000
lines changed

make_dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import fnmatch
33
import time
4+
import sys
45

56
import problems
67
import utils
@@ -38,6 +39,7 @@ def main(args):
3839
probs_by_template = utils.inv_dict({p: p.__module__.split(".")[-1] for p in all_probs})
3940

4041
used_templates = fnmatch.filter(probs_by_template, args.templates)
42+
utils.info(f"Python version {sys.version}")
4143
utils.info(f"Generating from templates: {used_templates}")
4244
problem_sets = []
4345
for name in used_templates: # order determined by import order in templates/__init__.py

problems.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,22 @@ class DebugProblem(Problem):
732732
The program will exit if it successful.
733733
"""
734734

735-
def add(self, inp: dict, test=True):
735+
# def __init__(self):
736+
# print("ho")
737+
# super().__init__()
738+
736739

740+
def add(self, inp: dict, test=True):
737741
if self.check_seen_input(inp):
738742
return # don't add duplicate problems
739743

740744
if test:
745+
var_name = self.sat_src_spec[1].args[0]
746+
type_assertion_str = gen_type_assertion(var_name, self.types[var_name])
741747
for s in self.sols:
742-
assert self.sat(s(**inp), **inp) is True, f"Puzzle {self.name} didn't return True on `{inp}`"
748+
answer = s(**inp)
749+
exec(type_assertion_str, {var_name: answer})
750+
assert self.sat(answer, **inp) is True, f"Puzzle {self.name} didn't return True on `{inp}`"
743751

744752
self.instances.append(("DEBUG TEST", bool(test and self.sols))) # for counting purposes
745753

0 commit comments

Comments
 (0)