diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-04-07 16:16:42 -0400 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-04-07 16:16:42 -0400 |
| commit | 277e5d08e28b5fcab8b019f66211883d976efbad (patch) | |
| tree | b1e8ae3ae602edb98236ea79676f913d0328c798 /src/25/solve.py | |
| parent | 73b29dfa9d07c37e8d4db2136cd73fdd9f0650b8 (diff) | |
| download | aoc2018-python-277e5d08e28b5fcab8b019f66211883d976efbad.tar.gz aoc2018-python-277e5d08e28b5fcab8b019f66211883d976efbad.zip | |
Add helper to check solutions and reorder to new layout
Diffstat (limited to 'src/25/solve.py')
| -rw-r--r-- | src/25/solve.py | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/src/25/solve.py b/src/25/solve.py deleted file mode 100644 index 2e0f817..0000000 --- a/src/25/solve.py +++ /dev/null @@ -1,100 +0,0 @@ -from sys import argv as args
-
-sinput = open("input.txt").read()
-
-ainput = """1,-1,-1,-2
--2,-2,0,1
-0,2,1,3
--2,3,-2,1
-0,2,3,-2
--1,-1,1,-2
-0,-2,-1,0
--2,2,3,-1
-1,2,2,0
--1,-2,0,-2"""
-
-ainput = """1,-1,0,1
-2,0,-1,0
-3,2,-1,0
-0,0,3,1
-0,0,-1,-1
-2,3,-2,0
--2,2,0,0
-2,-2,0,-1
-1,-1,0,-1
-3,2,0,2"""
-
-ainput = """0,0,0,0
- 3,0,0,0
- 0,3,0,0
- 0,0,3,0
- 0,0,0,3
- 0,0,0,6
- 9,0,0,0
-12,0,0,0"""
-
-ainput = """-1,2,2,0
-0,0,2,-2
-0,0,0,-2
--1,2,0,0
--2,-2,-2,2
-3,0,2,-1
--1,3,2,2
--1,0,-1,0
-0,2,1,-2
-3,0,0,0"""
-
-def parseLine(l):
- return [int(v) for v in l.split(",")]
-
-coordinates = [parseLine(l) for l in sinput.split("\n") if len(l) != 0]
-
-def dist(c1, c2):
- return sum([abs(c1[i] - c2[i]) for i in range(4)])
-
-def getClose(coords, c):
- match = list()
- j = 0
- while j in range(len(coords)):
- if dist(c, coords[j]) <= 3:
- match.append(coords[j])
- coords.pop(j)
- else:
- j += 1
- return match
-
-def solve1():
- constellations = list()
- available = coordinates[:]
-
- while len(available) != 0:
- match = getClose(available, available[0])
-
- j = 0
- while j < len(match):
- match += getClose(available, match[j])
- j += 1
-
- constellations.append(match)
-
- print(len(constellations))
-
- """
- sum = 0
- for cons in constellations:
- sum += len(cons)
- print(sum)
- """
- return
-
-def solve2():
- return
-
-def main():
- if len(args) > 1:
- if args[1] == "1":
- solve1()
- elif args[1] == "2":
- solve2()
-
-main()
|
