X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=rpl.py;h=b848afa756a6188a60d29a446bdd51d1e455b74a;hb=3e3bf1003aa0ecbf7d38b7b0c289fbe1cfa3101b;hp=7c1c96e2cd1f567f2c830c1d6040b79aaa436f47;hpb=5d46a9bd7d032d90ef4c4b38ac3c9b5b66526527;p=picoclvr.git
diff --git a/rpl.py b/rpl.py
index 7c1c96e..b848afa 100755
--- a/rpl.py
+++ b/rpl.py
@@ -58,7 +58,9 @@ rpl_ops = ["add", "min", "max", "swp", "rep", "dup", "del"]
######################################################################
-def generate(nb_starting_values=3, max_input=9, prog_len=6, nb_runs=5):
+def generate(
+ nb_starting_values=3, nb_result_values_max=None, max_input=9, prog_len=6, nb_runs=5
+):
prog_len = (1 + torch.randint(2 * prog_len, (1,))).clamp(max=prog_len).item()
while True:
@@ -73,11 +75,14 @@ def generate(nb_starting_values=3, max_input=9, prog_len=6, nb_runs=5):
result_stack = rpl_exec(prog, stack)
if len(result_stack) == 0:
no_empty_stack = False
- result = result + [""] + stack + ["