Add UI
parent
f1f271abbe
commit
31981b541e
19
lambdaV.py
19
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
|
||||
|
|
Loading…
Reference in New Issue