Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. m = [
  2.     [0] * 6,
  3.     [0] * 6,
  4.     [0, 0, 1, 0, 0, 0],
  5.     [0] * 6,
  6.     [0] * 6,
  7.     [0] * 6,
  8. ]
  9.  
  10. # 0 ->
  11. #       22
  12. #       20
  13. #
  14. # 1 ->
  15. #       22
  16. #       12
  17. #
  18. # 2 ->
  19. #       12
  20. #       22
  21. #
  22. # 3 ->
  23. #       21
  24. #       22
  25.  
  26. cover (m, p1, p2, start, start_type):
  27.     width = p2[0] - p1[0] + 1
  28.     height = p2[1] = p1[1] + 1
  29.     if width < 2 or height < 2:
  30.         return None
  31.     x,y = start;
  32.     if start_type == 0:
  33.         starts = [
  34.             start, (x, y + 1),
  35.             (x + 1, y), (x + 1, y + 1)
  36.         ]
  37.     elif start_type == 1:
  38.         starts = [
  39.             (x - 1, y), start,
  40.             (x - 1, y - 1), (x - 1, y)
  41.         ]
  42.     elif start_type == 2:
  43.         starts = [
  44.             (x - 1, y), (x - 1, y + 1),
  45.             start, (x, y + 1)
  46.         ]
  47.     else:
  48.         starts = [
  49.             (x - 1, y - 1), (x - 1, y),
  50.             (x, y - 1), start
  51.         ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement