From 31981b541ef8b91e22efbb95422173e7f7f8306e Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Wed, 30 Nov 2022 15:16:15 +0100 Subject: [PATCH] Add UI --- lambdaV.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lambdaV.py b/lambdaV.py index e2c7db9..de0c38e 100644 --- a/lambdaV.py +++ b/lambdaV.py @@ -53,8 +53,7 @@ cursor_position = [0, 0] command_delay = 0.3 -def clear_field(): - field = [ +empty_field = [ " _________________ ", "| |", "| |", @@ -506,12 +505,22 @@ def evaluate_parser_result(parsed_code): return "Goal not reached!" -def debug_setup(): +def setup_and_run_task(start_field, start_position, start_heading, text, allowed_commands, allowed_conditions): global cursor_position - cursor_position = [1,1] + cursor_position = start_position global cursor_current - cursor_current = cursor_south + cursor_current = start_heading + global field + field = start_field draw_field() + print("\n"+text) + print("\nAllowed commands: "+" ,".join(allowed_commands)) + print("\nAvailable conditions: "+" ,".join(allowed_conditions)) + print(evaluate_parser_result(parse_code(input("\nCode: "), allowed_commands, allowed_conditions))) + #TODO: return information about success or failure + +def debug_setup(): + setup_and_run_task(empty_field, [1,1], cursor_east, "Debug mode", ["step", "left", "right", "take", "repeat", "while", "if"], ["facing north", "facing south", "facing east", "facing west", "in front of wall", "goal reached", "on apple"]) if __name__ == "__main__": pass