Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.19 KB | None | 0 0
  1. import math
  2. _input = [".............#..#.#......##........#..#",".#...##....#........##.#......#......#.","..#.#.#...#...#...##.#...#.............",".....##.................#.....##..#.#.#","......##...#.##......#..#.......#......","......#.....#....#.#..#..##....#.......","...................##.#..#.....#.....#.","#.....#.##.....#...##....#####....#.#..","..#.#..........#..##.......#.#...#....#","...#.#..#...#......#..........###.#....","##..##...#.#.......##....#.#..#...##...","..........#.#....#.#.#......#.....#....","....#.........#..#..##..#.##........#..","........#......###..............#.#....","...##.#...#.#.#......#........#........","......##.#.....#.#.....#..#.....#.#....","..#....#.###..#...##.#..##............#","...##..#...#.##.#.#....#.#.....#...#..#","......#............#.##..#..#....##....",".#.#.......#..#...###...........#.#.##.","........##........#.#...#.#......##....",".#.#........#......#..........#....#...","...............#...#........##..#.#....",".#......#....#.......#..#......#.......",".....#...#.#...#...#..###......#.##....",".#...#..##................##.#.........","..###...#.......#.##.#....#....#....#.#","...#..#.......###.............##.#.....","#..##....###.......##........#..#...#.#",".#......#...#...#.##......#..#.........","#...#.....#......#..##.............#...","...###.........###.###.#.....###.#.#...","#......#......#.#..#....#..#.....##.#..",".##....#.....#...#.##..#.#..##.......#.","..#........#.......##.##....#......#...","##............#....#.#.....#...........","........###.............##...#........#","#.........#.....#..##.#.#.#..#....#....","..............##.#.#.#...........#....."]
  3. _stars = []
  4. class Star:
  5.     x=y=0
  6. def getStars():
  7.     global _count
  8.     for x in _stars:
  9.         _f = dict()
  10.         for y in _stars:
  11.             if x != y:
  12.                 _f[((math.atan2(x.y - y.y, x.x - y.x) - math.pi / 2) * (180 / math.pi) + 360) % 360] = y
  13.         _count[str(x.x)+"/"+str(x.y)] = _f
  14. for i,x in enumerate(_input):
  15.     for j,y in enumerate(x):
  16.         if y == "#":
  17.             s = Star()
  18.             s.x = j
  19.             s.y = i
  20.             _stars.append(s)
  21. _count = dict()
  22. getStars()
  23. _max = 0
  24. _max_star_pos = None
  25. for x in _count:
  26.     if len(_count[x]) > _max:
  27.         _max = len(_count[x])
  28.         _max_star_pos = x
  29. print(_max_star_pos)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement