beginning_of_program define_new_instruction turnright as {iterate 3 times turnleft;} define_new_instruction baila as {if front_is_clear then { if right_is_blocked then {move; baila;} if right_is_clear then {iterate 4 times turnright;} if left_is_blocked then {iterate 2 times turnleft; if front_is_clear then baila;} } if front_is_blocked then {turnleft; baila;} if right_is_clear then {if front_is_clear then {turnleft; move;}} } beginning_of_execution baila; move; turnoff; end_of_execution end_of_program