Advertisement
Guest User

30

a guest
Oct 18th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.00 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. from pyrob.api import *
  4. def xxx():
  5.     move_right()
  6.     fill_cell()
  7.     move_right()
  8.     fill_cell()
  9.     move_down()
  10.     fill_cell()
  11.     move_up()
  12.     move_right()
  13.     fill_cell()
  14.     move_right()
  15. def yyy():
  16.     move_down()
  17.     fill_cell()
  18.     move_down()
  19.     fill_cell()
  20.     move_left()
  21.     fill_cell()
  22.     move_right()
  23.     move_down()
  24.     fill_cell()
  25.     move_down()
  26. def xxx2():
  27.     move_left()
  28.     fill_cell()
  29.     move_left()
  30.     fill_cell()
  31.     move_up()
  32.     fill_cell()
  33.     move_down()
  34.     move_left()
  35.     fill_cell()
  36.     move_left()
  37. def yyy2():
  38.     move_up()
  39.     fill_cell()
  40.     move_up()
  41.     fill_cell()
  42.     move_right()
  43.     fill_cell()
  44.     move_left()
  45.     move_up()
  46.     fill_cell()
  47.     move_up()  
  48.  
  49. def xm():
  50.     a=0
  51.     b=0
  52.     c=0
  53.     o=0
  54.     while not wall_is_on_the_right():
  55.         a+=1
  56.         move_right()    
  57.     if a>=6:
  58.         b=a-5
  59.         b=b/2
  60.         o=a
  61.         while b>0:
  62.             move_left(a)
  63.             move_right(c+1)
  64.             b-=1
  65.             o=o-2
  66.             for _ in range(o):
  67.                 fill_cell()
  68.                 move_right()
  69.                 for _ in range(o):
  70.                     fill_cell()
  71.             move_right(c+1)
  72.             move_down()
  73.             c+=1
  74.         else:
  75.             move_left(a)
  76.             move_right(c)
  77.             xxx()
  78.     else:
  79.         move_left(a)
  80.         xxx()
  81.  
  82. def ym():
  83.     d=0
  84.     e=0
  85.     f=0
  86.     x=0
  87.     while not wall_is_beneath():
  88.         d+=1
  89.         move_down()    
  90.     if d>=6:
  91.         e=d-5
  92.         e=e/2
  93.         x=d        
  94.         while e>0:
  95.             move_up(d)
  96.             move_down(f+1)
  97.             e-=1
  98.             x=x-2
  99.             for _ in range(x):
  100.                 fill_cell()
  101.                 move_down()
  102.                 for _ in range(x):
  103.                     fill_cell()
  104.             move_down(f+1)
  105.             move_left()
  106.             f+=1
  107.         else:
  108.             move_up(d)
  109.             move_down(f)
  110.             yyy()
  111.     else:
  112.         move_up(d)
  113.         yyy()
  114.  
  115. def x2m():
  116.     m=0
  117.     h=0
  118.     z=0
  119.     v=0
  120.     while not wall_is_on_the_left():
  121.         m+=1
  122.         move_left()    
  123.     if m>=6:
  124.         h=m-5
  125.         h=h/2
  126.         v=m  
  127.         while h>0:
  128.             move_right(m)
  129.             move_left(z+1)
  130.             h-=1
  131.             v=v-2
  132.             for _ in range(v):
  133.                 fill_cell()
  134.                 move_left()
  135.                 for _ in range(v):
  136.                     fill_cell()
  137.             move_left(z+1)
  138.             move_up()
  139.             z+=1
  140.         else:
  141.             move_right(m)
  142.             move_left(z)
  143.             xxx2()
  144.     else:
  145.         move_right(m)
  146.         xxx2()
  147.  
  148. def y2m():
  149.     j=0
  150.     k=0
  151.     l=0
  152.     s=0
  153.     while not wall_is_above():
  154.         j+=1
  155.         move_up()    
  156.     if j>=6:
  157.         k=j-5
  158.         k=k/2
  159.         s=j
  160.         while k>0:
  161.             move_down(j)
  162.             move_up(l+1)
  163.             k-=1
  164.             s=s-2
  165.             for _ in range(s):
  166.                 fill_cell()
  167.                 move_up()
  168.                 for _ in range(s):
  169.                     fill_cell()
  170.             move_up(l+1)
  171.             move_right()
  172.             l+=1
  173.         else:
  174.             move_down(j)
  175.             move_up(l)
  176.             yyy2()
  177.     else:
  178.         move_down(j)
  179.         yyy2()
  180.    
  181. @task
  182. def task_9_3():
  183.     xm()
  184.     while not wall_is_above():
  185.         move_up()
  186.         while not wall_is_on_the_right():
  187.             move_right()
  188.     ym()
  189.     while not wall_is_on_the_right():
  190.         move_right()
  191.         while not wall_is_beneath():
  192.             move_down()
  193.     x2m()
  194.     while not wall_is_beneath():
  195.         move_down()
  196.         while not wall_is_on_the_left():
  197.             move_left()
  198.     y2m()
  199.     while not wall_is_on_the_left():
  200.         move_left()
  201.         while not wall_is_above():
  202.             move_up()
  203.     while not wall_is_on_the_right() and not wall_is_beneath():
  204.         move_down()
  205.  
  206. if __name__ == '__main__':
  207.     run_tasks()
  208.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement