2 просмотров
Яндекс-учебник, 6-7 класс. Задачи повышенной сложности «Цикл с условием» (Blockly) - покажу мысли по решению пяти интересных задач 1. while wall_from_left(): fill_cell() move_up() fill_cell() move_left() while wall_from_down(): fill_cell() move_left() fill_cell() move_down() while wall_from_right(): fill_cell() move_down() fill_cell() move_right() while wall_from_up(): fill_cell() move_right() while cell_is_clean(): fill_cell() move_up() 2. while free_from_up(): move_up() fill_cell() while free_from_down(): move_down() fill_cell() while wall_from_left(): move_up() while free_from_left(): move_left() fill_cell() while free_from_right(): move_right() fill_cell() while wall_from_down(): move_left() 3. fill_cell() while free_from_up(): move_up() if free_from_up(): move_up() fill_cell() 4. while free_from_down(): move_down() while free_from_left(): move_left() while free_from_down(): move_down() while free_from_right(): while free_from_up() and free_from_right(): move_up() if free_from_right(): while free_from_down(): move_down() move_right() 5. while free_from_up() and cell_is_clean(): move_up() if cell_is_clean(): while cell_is_clean() and free_from_down(): move_down() if cell_is_clean(): while wall_from_left(): move_up() while cell_is_clean() and free_from_left(): move_left() if cell_is_clean(): while cell_is_clean(): move_right()