Repeat the same level until success
parent
e814cfe21d
commit
f8e316bdc4
|
@ -516,7 +516,11 @@ def setup_and_run_task(start_field, start_position, start_heading, text, allowed
|
||||||
print("\n"+text)
|
print("\n"+text)
|
||||||
print("\nAllowed commands: "+", ".join(allowed_commands))
|
print("\nAllowed commands: "+", ".join(allowed_commands))
|
||||||
print("\nAvailable conditions: "+", ".join(allowed_conditions))
|
print("\nAvailable conditions: "+", ".join(allowed_conditions))
|
||||||
print(evaluate_parser_result(parse_code(input("\nCode: "), allowed_commands, allowed_conditions)))
|
result = evaluate_parser_result(parse_code(input("\nCode: "), allowed_commands, allowed_conditions))
|
||||||
|
print(result)
|
||||||
|
if result=="Success!":
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys, os, json
|
import sys, os, json
|
||||||
|
@ -568,7 +572,8 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
print("Unknown start heading!")
|
print("Unknown start heading!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
setup_and_run_task(level_data["field"], level_data["start position"], cursor_start, level_data["text"], level_data["allowed commands"], level_data["allowed conditions"])
|
while not setup_and_run_task(level_data["field"].copy(), level_data["start position"].copy(), cursor_start, level_data["text"], level_data["allowed commands"].copy(), level_data["allowed conditions"].copy()):
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
if single_file_mode:
|
if single_file_mode:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue