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vv^<><<>v^vv^<<<^^>v<<>>>v<>v<><<^v>^^v>^^>v>^>^>v<>><>^>^>^vvvv<^^^^^v>v>><>^>^><>^^>v^^<<><^><<<<>v>^^>^v<<<>vvv>>v<^v>>v>v^<<<>^>^>^<>v<^^vv><^v<<^vv<^<<^^vv^^>vv<^>v>^^<^>v<<^^<^>^^^v^^>>v^vv^<^v>^<>^<^>>^<^v<>v><^^<><>^>v<^<^vv>><^v>^<>^^>^<><<>^<>><<>vvv^<<^^>>v<^>>vv>^v^^^v<>v<>><>^vv^>vv^ \ No newline at end of file diff --git a/day3/in2 b/day3/in2 new file mode 100644 index 0000000..03504fc --- /dev/null +++ b/day3/in2 @@ -0,0 +1 @@ +^><^>>>^<^v<<^<><^<^v>^vv<>v>>^^^v<<<^>^<^v<^>^v><<<^>><>v>v^<<^>^<<^^^>v>>v^^>^>vv>>^>>v^>^v>^<^^v>^>^^v^^>v^^v><^><^<<>v^<^<^vv^>>>v^v^>^<>^v<^^vv^>^<>^^<vv<>^>v<^>^v>v^>^v<>^><>>v^v<><>v^v>>>>v^^>^><^^<^>^v^v<>v<<<^<v^^^<^^^>v<^v>>>>>v<^^^^>v<^<>>>>>>v^vvvv^^^v<^v^>v><^>^v<<>>vv^>v>v^^>vv^<^vvv<>><>><><^^^^<^^^<^v>>v>^v^^^>v^^^v>>^v^^<^>>^>^<>>^^<>>^vv>v^<^>>>><><^^v<><<<<^^<>>^<>vv^<^>v^^><^v>^^>v<>^v^<>^vv^>vvv>v>^>^>>^>><>>>^^^^v^<>v^^>^<>v<^^v><^v><>^^^^^v^v>>^^v><<><^^^^><^>v>><<<^v>v^^>^v^<^^v>v<^<<>>^v<<>v<^v^>v^>^v<<v>v>>v>v^^v>^v^>>>><>^>v>^v^>>>>v^<<<>vvv>><^^>^<><^^<^v^v^<^^>^<^v^<<<^^v^v>>><>^^>vv<<^v^<<<<^^>>>v>v<<<>^^>>>v>^>v>vv<<>^<^>^^<^>^v^<>v^><^^^>vv>><^v<^<<<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v^>>v^<^>v^v>>>>^>>vv<>^<^v>v>v^v>^<>^>v<<>^<>>^<>>^<>v^><<>^v>>^^^^<<^v><>^<^>^^v><^^<^^v>v<<^>^>><<^^^vvv<<^vv<^^>v^^vv^<^^<<^^>>^^<v^>>v^^>v<^>^>vv>><v><^<^vv>^^v>^>v<<^vv><^^^^^^><<^>>>^v<>^^v<<<>><<<>^<<v^>^^^<^>^^^v<<>v^><<^^<<^v<<>^v>>vv>><<^v^^>v^v>^^v<><^^^<^^>v>^<>vvv^v^^^>v^^v<^>^^>>^v<><^><^<<^vv^<><<>v^vv^<<<^^>v<<>>>v<>v<><<^v>^^v>^^>v>^>^>v<>><>^>^>^vvvv<^^^^^v>v>><>^>^><>^^>v^^<<><^><<<<>v>^^>^v<<<>vvv>>v<^v>>v>v^<<<>^>^>^<>v<^^vv><^v<<^vv<^<<^^vv^^>vv<^>v>^^<^>v<<^^<^>^^^v^^>>v^vv^<^v>^<>^<^>>^<^v<>v><^^<><>^>v<^<^vv>><^v>^<>^^>^<><<>^<>><<>vvv^<<^^>>v<^>>vv>^v^^^v<>v<>><>^vv^>vv^ \ No newline at end of file diff --git a/day3/so1.py b/day3/so1.py new file mode 100644 index 0000000..cf61e92 --- /dev/null +++ b/day3/so1.py @@ -0,0 +1,38 @@ +NORTH = "^" +SOUTH = "v" +WEST = "<" +EAST = ">" + +def move(pos, d): + if d == NORTH: + pos[1] += 1 + if d == SOUTH: + pos[1] -= 1 + if d == WEST: + pos[0] -= 1 + if d == EAST: + pos[0] += 1 + +def visit(s): + pos = [0,0] + visits = set() + visits.add((pos[0], pos[1])) + + for c in s: + move(pos, c) + visits.add((pos[0], pos[1])) + + return len(visits) + +def test(): + assert visit(">") == 2 + assert visit("^>v<") == 4 + assert visit("^v^v^v^v^v") == 2 + +def solution(): + with open("in1") as puzzle: + l = puzzle.read() + return visit(l) + +if __name__ == "__main__": + print(f"Houses: {solution()}") diff --git a/day3/so2.py b/day3/so2.py new file mode 100644 index 0000000..e8f8055 --- /dev/null +++ b/day3/so2.py @@ -0,0 +1,51 @@ +NORTH = "^" +SOUTH = "v" +WEST = "<" +EAST = ">" + +class Santa: + def __init__(self, visits): # visits is a ref + self.pos = [0,0] + self.visits = visits + self.visits.add((self.pos[0], self.pos[1])) + + def move(self, d): + if d == NORTH: + self.pos[1] += 1 + if d == SOUTH: + self.pos[1] -= 1 + if d == WEST: + self.pos[0] -= 1 + if d == EAST: + self.pos[0] += 1 + + def visit(self, d): + self.move(d) + self.visits.add((self.pos[0], self.pos[1])) + +def visit(l): + visits = set() + + robo = Santa(visits) + santa = Santa(visits) + for i,c in enumerate(l): + if i%2 == 0: + santa.visit(c) + else: + robo.visit(c) + + return len(visits) + + +def test(): + assert visit("^v") == 3 + assert visit("^>v<") == 3 + assert visit("^v^v^v^v^v") == 11 + +def solution(): + with open("in2") as puzzle: + l = puzzle.read() + return visit(l) + +if __name__ == "__main__": + print(f"Houses: {solution()}")