SaveText.Ru

1
  1. def line():
  2.     fill_cell()
  3.     while free_from_right():
  4.         move_right()
  5.         fill_cell()
  6.     while free_from_left():
  7.         move_left()
  8.         fill_cell()
  9. def down():
  10.     move_down()
  11.     move_down()
  12. if free_from_right() and free_from_down() and free_from_up() and free_from_left():
  13.     move_down()
  14.     if free_from_down():
  15.         move_up()
  16.         line()
  17.         move_up()
  18.         move_up()
  19.         line()
  20.         down()
  21.         down()
  22.         line()
  23.     else:
  24.         move_up()
  25.         while free_from_up():
  26.             move_up()
  27.         move_down()
  28.         line()
  29.         for e in range(3):
  30.             down()
  31.             line()
  32. elif free_from_left() and wall_from_up() and wall_from_right():
  33.     for b in range(3):
  34.         line()
  35.         down()
  36.     line()
  37. elif wall_from_down() and free_from_right() and free_from_up():
  38.     line()
  39. elif wall_from_up() and wall_from_down() and wall_from_right():
  40.     fill_cell()
  41. elif wall_from_right() and wall_from_left() and free_from_up():
  42.     for c in range(3):
  43.         move_up()
  44.     fill_cell()
  45.     for d in range(3):
  46.         down()
  47.         fill_cell()

Share with your friends:

Print