Commit fb4e2a88 by nzy

Remove namedtuple; Save robotB's code and show Output for user

parent 6ba580bf
......@@ -96,7 +96,6 @@ class ANPL:
ENV = ast.parse('''
import numpy as np
from collections import namedtuple
from typing import *
black, blue, red, green, yellow, grey, pink, orange, teal, maroon = range(10)
''')
......
from anpl.synthesizer import raw_query, msg
from utils import sys_str, system_info, multiline_input, select_task, set_openai_key
from utils import sys_str, system_info, multiline_input, select_task, set_openai_key, rich_dumps
from rich.prompt import IntPrompt, Confirm, Prompt
from rich import print
from anpl.sandbox import import_module_from_string
......@@ -78,10 +78,15 @@ while not is_correct:
if np.array_equal(out, real_out):
logger.log("system", "check", f"correct")
system_info("[green] Code CORRECT [/green]")
time_str = time.strftime("%Y%m%d_%H%M%S")
with open(f"./log/btask{task_id}_{time_str}.py", "w") as f:
f.write(code)
is_correct = True
else:
logger.log("system", "check", f"wrong")
system_info("[red] Code WRONG [/red]")
print("The output is")
print(rich_dumps(out))
else:
quit_time = time.time()
if quit_time - logger.start_time < 30 * 60:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment