Compare commits

...

10 Commits

28 changed files with 2290 additions and 0 deletions

40
day17.py Normal file
View File

@ -0,0 +1,40 @@
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
inputs = [
[
(638, "input17_test"),
(1506, "input17"),
],
[
(39479736, "input17")
]
]
def part1(self) -> Any:
step = self.getInput(int)
buffer = [0]
index = 0
for i in range(2017):
index = (index + step) % len(buffer) + 1
buffer.insert(index, i + 1)
return buffer[buffer.index(2017) + 1]
def part2(self) -> Any:
step = self.getInput(int)
index = 0
ans = 0
for i in range(50_000_000):
index = (index + step) % (i + 1) + 1
if index == 1:
ans = i + 1
return ans
if __name__ == '__main__':
day = Day(2017, 17)
day.run(verbose=True)

114
day18.py Normal file
View File

@ -0,0 +1,114 @@
import time
from collections import defaultdict
from threading import Thread
from tools.aoc import AOCDay
from typing import Any
from queue import Queue
class Duet(Thread):
def __init__(self, commands: list, pid: int = 0, input_queue: Queue = None, export_queue: Queue = None) -> None:
super().__init__()
self.commands = commands
self.pid = pid
self.input_queue = input_queue
self.export_queue = export_queue
self.state = 0
self.output = 0
def run(self) -> None:
last_freq = 0
register = defaultdict(int)
register['p'] = self.pid
index = 0
while 0 <= index < len(self.commands):
cmd = self.commands[index]
if len(cmd) == 3:
value_index = 2
else:
value_index = 1
try:
value = int(cmd[value_index])
except ValueError:
value = register[cmd[value_index]]
match cmd[0]:
case "snd":
last_freq = value
if self.export_queue is not None:
self.export_queue.put(value)
self.output += 1
case "set":
register[cmd[1]] = value
case "add":
register[cmd[1]] += value
case "mul":
register[cmd[1]] *= value
case "mod":
register[cmd[1]] %= value
case "rcv":
if self.input_queue is not None:
self.state = 1
while self.input_queue.empty():
time.sleep(0.01)
register[cmd[1]] = self.input_queue.get()
self.state = 0
else:
if register[cmd[1]] != 0:
self.output = last_freq
return
case "jgz":
try:
if int(cmd[1]) > 0:
index += value - 1
except ValueError:
if register[cmd[1]] > 0:
index += value - 1
case _:
raise ValueError("Unknown command: " + cmd[0])
index += 1
return
class Day(AOCDay):
inputs = [
[
(4, "input18_test"),
(7071, "input18")
],
[
(3, "input18_test2"),
(8001, "input18")
]
]
def part1(self) -> Any:
duet = Duet([x.split(" ") for x in self.getInput()])
duet.start()
duet.join()
return duet.output
def part2(self) -> Any:
q1, q2 = Queue(), Queue()
p1 = Duet([x.split(" ") for x in self.getInput()], 0, q1, q2)
p2 = Duet([x.split(" ") for x in self.getInput()], 1, q2, q1)
p1.daemon = True
p2.daemon = True
p1.start()
p2.start()
while p1.is_alive() or p2.is_alive():
if (p1.state == 1 and q1.empty()) and (p2.state == 1 and q2.empty()):
return p2.output
time.sleep(0.01)
return p2.output
if __name__ == '__main__':
day = Day(2017, 18)
day.run(verbose=True)

72
day19.py Normal file
View File

@ -0,0 +1,72 @@
from tools.aoc import AOCDay
from tools.coordinate import Coordinate
from tools.grid import Grid
from typing import Any
class Day(AOCDay):
inputs = [
[
('ABCDEF', "input19_test"),
('FEZDNIVJWT', "input19")
],
[
(38, "input19_test"),
(17200, "input19")
]
]
def getLineGrid(self) -> Grid:
grid = Grid()
for y, line in enumerate(self.getInput()):
for x, char in enumerate(line):
if char != ' ':
grid.set(Coordinate(x, y), char)
return grid
def walkMaze(self) -> (str, int):
maze = self.getLineGrid()
x = 0
for i in maze.rangeX():
if maze.get(Coordinate(i, 0)):
x = i
break
letters = ''
step_count = 1
start = Coordinate(x, 0)
last_pos = Coordinate(0, 0)
last_dir = Coordinate(0, 1)
neighbours = maze.getNeighboursOf(start, includeDiagonal=False) + [Coordinate(0, 0)]
while len(neighbours) > 1:
step_count += 1
if maze.get(start + last_dir):
last_pos = start
start += last_dir
else:
if last_pos in neighbours:
neighbours.remove(last_pos)
last_pos = start
last_dir = neighbours[0] - start
start = neighbours[0]
if maze.get(start) in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz':
letters += maze.get(start)
neighbours = maze.getNeighboursOf(start, includeDiagonal=False)
return letters, step_count
def part1(self) -> Any:
letters, _ = self.walkMaze()
return letters
def part2(self) -> Any:
_, steps = self.walkMaze()
return steps
if __name__ == '__main__':
day = Day(2017, 19)
day.run(verbose=True)

85
day20.py Normal file
View File

@ -0,0 +1,85 @@
from tools.aoc import AOCDay
from tools.coordinate import Coordinate, DistanceAlgorithm
from typing import Any
ZERO = Coordinate(0, 0, 0)
class Particle:
def __init__(self, pos: Coordinate, vel: Coordinate, acc: Coordinate):
self.pos = pos
self.vel = vel
self.acc = acc
def move(self):
self.vel += self.acc
self.pos += self.vel
def dist(self):
return self.pos.getDistanceTo(ZERO, algorithm=DistanceAlgorithm.MANHATTAN, includeDiagonals=False)
class Day(AOCDay):
inputs = [
[
(0, "input20_test"),
(457, "input20")
],
[
(1, "input20_test2"),
(448, "input20")
]
]
def getParticles(self) -> list:
particles = []
for line in self.getInput():
p, v, a = line.split(", ")
p = Coordinate(*map(int, p[3:-1].split(",")))
v = Coordinate(*map(int, v[3:-1].split(",")))
a = Coordinate(*map(int, a[3:-1].split(",")))
particles.append(Particle(p, v, a))
return particles
def part1(self) -> Any:
particles = self.getParticles()
closest = 0
last_closest = list(range(-1, -1000, -1))
while len(set(last_closest)) != 1:
last_closest.append(closest)
last_closest.pop(0)
min_dist = 10e9
for i, p in enumerate(particles):
p.move()
if p.dist() < min_dist:
closest = i
min_dist = p.dist()
return closest
def part2(self) -> Any:
particles = self.getParticles()
for _ in range(1000):
pos_cache = {}
new_particles = []
for i, p in enumerate(particles.copy()):
p.move()
if p.pos not in pos_cache:
new_particles.append(p)
pos_cache[p.pos] = len(new_particles) - 1
else:
if pos_cache[p.pos] >= 0:
new_particles.pop(pos_cache[p.pos])
pos_cache[p.pos] = -1
particles = new_particles
return len(particles)
if __name__ == '__main__':
day = Day(2017, 20)
day.run(verbose=True)

94
day21.py Normal file
View File

@ -0,0 +1,94 @@
from tools.aoc import AOCDay
from tools.coordinate import Coordinate
from tools.grid import Grid, GridTransformation
from typing import Any
FLIPS = [
GridTransformation.ROTATE_RIGHT,
GridTransformation.ROTATE_RIGHT,
GridTransformation.ROTATE_RIGHT,
GridTransformation.ROTATE_RIGHT,
GridTransformation.FLIP_HORIZONTALLY,
GridTransformation.ROTATE_RIGHT,
GridTransformation.ROTATE_RIGHT,
GridTransformation.ROTATE_RIGHT,
]
def init_grid() -> Grid:
grid = Grid()
grid.set(Coordinate(1, 0))
grid.set(Coordinate(2, 1))
grid.set(Coordinate(0, 2))
grid.set(Coordinate(1, 2))
grid.set(Coordinate(2, 2))
return grid
class Day(AOCDay):
inputs = [
[
(12, "input21_test"),
(176, "input21")
],
[
(2368161, "input21")
]
]
def load_replacement_grids(self) -> dict:
ret = {}
for line in self.getInput():
rep, grid_string = line.split(" => ")
ret[rep] = Grid.from_str(grid_string, true_char='#')
rep_grid_size = len(rep.split("/")[0]) + 1
ret[rep].minX, ret[rep].maxX, ret[rep].minY, ret[rep].maxY = 0, rep_grid_size, 0, rep_grid_size
return ret
def interact(self, interact_count: int) -> int:
grid = Grid.from_str('.#./..#/###')
grid_size = 3
replacements = self.load_replacement_grids()
for i in range(2 if self._current_test_file.endswith('test') else interact_count):
new_grid = Grid()
block_size = 3
replace_size = 4
if grid_size % 2 == 0:
block_size = 2
replace_size = 3
for x in range(0, grid_size, block_size):
for y in range(0, grid_size, block_size):
sub_grid = grid.sub_grid(x, y, x + block_size - 1, y + block_size - 1)
sub_grid.minX, sub_grid.minY, sub_grid.maxX, sub_grid.maxY = 0, 0, block_size - 1, block_size - 1
for f in FLIPS:
sub_grid.transform(f)
sub_grid.maxX, sub_grid.maxY = block_size - 1 + sub_grid.minX, block_size - 1 + sub_grid.minY
if str(sub_grid) in replacements:
new_grid.update(
x // block_size * replace_size,
y // block_size * replace_size,
replacements[str(sub_grid)]
)
break
else:
raise ValueError("No sub_grid matches found.")
grid = new_grid
grid_size = grid_size // block_size * replace_size
return grid.getOnCount()
def part1(self) -> Any:
return self.interact(5)
def part2(self) -> Any:
return self.interact(18)
if __name__ == '__main__':
day = Day(2017, 21)
day.run(verbose=True)

90
day22.py Normal file
View File

@ -0,0 +1,90 @@
from enum import Enum
from tools.aoc import AOCDay
from tools.coordinate import Coordinate
from tools.grid import Grid
from typing import Any
DIRECTIONS = [
Coordinate(0, -1),
Coordinate(1, 0),
Coordinate(0, 1),
Coordinate(-1, 0)
]
class NodeState(Enum):
CLEAN = 0
WEAKENED = 1
INFECTED = 2
FLAGGED = 3
class Day(AOCDay):
inputs = [
[
(5587, "input22_test"),
(5460, "input22")
],
[
(2511944, "input22_test"),
(2511702, "input22")
]
]
def get_init_state(self) -> (Grid, int, Coordinate):
grid = Grid.from_str(
"/".join(self.getInput()),
true_char='#',
true_value=NodeState.INFECTED,
default=NodeState.CLEAN
)
carrier_direction_index = 0
cattier_position = Coordinate((len(self.getInput()[0]) - 1) // 2, (len(self.getInput()) - 1) // 2)
return grid, carrier_direction_index, cattier_position
def part1(self) -> Any:
grid, carrier_direction_index, carrier_position = self.get_init_state()
infect_count = 0
for _ in range(10_000):
if grid.get(carrier_position) == NodeState.INFECTED:
carrier_direction_index = (carrier_direction_index + 1) % 4
grid.set(carrier_position, NodeState.CLEAN)
else:
infect_count += 1
carrier_direction_index = (carrier_direction_index - 1) % 4
grid.set(carrier_position, NodeState.INFECTED)
carrier_position += DIRECTIONS[carrier_direction_index]
return infect_count
def part2(self) -> Any:
grid, carrier_direction_index, carrier_position = self.get_init_state()
infect_count = 0
for _ in range(10_000_000):
match grid.get(carrier_position):
case NodeState.CLEAN:
carrier_direction_index = (carrier_direction_index - 1) % 4
grid.set(carrier_position, NodeState.WEAKENED)
case NodeState.WEAKENED:
grid.set(carrier_position, NodeState.INFECTED)
infect_count += 1
case NodeState.INFECTED:
carrier_direction_index = (carrier_direction_index + 1) % 4
grid.set(carrier_position, NodeState.FLAGGED)
case NodeState.FLAGGED:
carrier_direction_index = (carrier_direction_index + 2) % 4
grid.set(carrier_position, NodeState.CLEAN)
carrier_position += DIRECTIONS[carrier_direction_index]
return infect_count
if __name__ == '__main__':
day = Day(2017, 22)
day.run(verbose=True)

69
day23.py Normal file
View File

@ -0,0 +1,69 @@
from collections import defaultdict
from tools.aoc import AOCDay
from typing import Any
from tools.math import get_factors
class Day(AOCDay):
inputs = [
[
(4225, "input23")
],
[
(905, "input23")
]
]
def get_commands(self) -> list:
return [x.split(" ") for x in self.getInput()]
def part1(self) -> Any:
register = defaultdict(int)
index = 0
commands = self.get_commands()
mul_count = 0
while 0 <= index < len(commands):
cmd = commands[index]
try:
value = int(cmd[2])
except ValueError:
value = register[cmd[2]]
match cmd[0]:
case "set":
register[cmd[1]] = value
case "sub":
register[cmd[1]] -= value
case "mul":
mul_count += 1
register[cmd[1]] *= value
case "jnz":
try:
jumper = int(cmd[1])
except ValueError:
jumper = register[cmd[1]]
if jumper != 0:
index += value - 1
index += 1
return mul_count
def part2(self) -> Any:
b = int(self.getInput()[0].split(" ")[2]) * 100 + 100000
c = b + 17000
h = 0
while b <= c:
if len(get_factors(b)) > 2:
h += 1
b += 17
return h
if __name__ == '__main__':
day = Day(2017, 23)
day.run(verbose=True)

65
day24.py Normal file
View File

@ -0,0 +1,65 @@
from tools.aoc import AOCDay
from typing import Any
def get_max_bridge_strength(bridge_parts: list, connect_to: int) -> int:
max_strength = 0
for part in bridge_parts:
if connect_to not in part:
continue
sub_parts = bridge_parts.copy()
sub_parts.remove(part)
this_strength = sum(part) + get_max_bridge_strength(sub_parts, part[int(not part.index(connect_to))])
max_strength = max(max_strength, this_strength)
return max_strength
def get_possible_bridges(bridge_parts: list, connect_to: int) -> list:
bridges = []
for part in bridge_parts:
if connect_to not in part:
continue
sub_parts = bridge_parts.copy()
sub_parts.remove(part)
bridges.append([part])
sub_bridges = get_possible_bridges(sub_parts, part[int(not part.index(connect_to))])
for sub_bridge in sub_bridges:
bridges.append([part] + sub_bridge)
return bridges
class Day(AOCDay):
inputs = [
[
(31, "input24_test"),
(1940, "input24")
],
[
(19, "input24_test"),
(1928, "input24")
]
]
def get_bridge_parts(self) -> list:
return [
list(map(int, line.split("/")))
for line in self.getInput()
]
def part1(self) -> Any:
return get_max_bridge_strength(self.get_bridge_parts(), 0)
def part2(self) -> Any:
bridges = get_possible_bridges(self.get_bridge_parts(), 0)
max_length = max(map(len, bridges))
return max(sum(sum(x) for x in b) for b in bridges if len(b) == max_length)
if __name__ == '__main__':
day = Day(2017, 24)
day.run(verbose=True)

69
day25.py Normal file
View File

@ -0,0 +1,69 @@
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
inputs = [
[
(3, "input25_test"),
(5593, "input25")
],
[
(None, "input25")
]
]
def get_blueprint(self) -> (str, int, dict):
i = self.getInput()
begin_state = i[0][-2]
step_count = int(i[1].split(" ")[-2])
blueprint = {}
current_state = ''
current_value_order = {}
for line in i[3:]:
if not line:
blueprint[current_state].append(current_value_order)
elif line.startswith("In state "):
current_state = line[-2]
blueprint[current_state] = []
elif line.startswith(" If the current value is"):
if line[-2] == '1':
blueprint[current_state].append(current_value_order)
current_value_order = {}
elif line.startswith(" - Write"):
current_value_order['write'] = int(line.split(" ")[-1][:-1])
elif line.startswith(" - Move"):
current_value_order['move'] = -1 if line.split(" ")[-1] == 'left.' else 1
elif line.startswith(" - Continue"):
current_value_order['continue'] = line[-2]
blueprint[current_state].append(current_value_order)
return begin_state, step_count, blueprint
def part1(self) -> Any:
current_state, step_count, blueprint = self.get_blueprint()
tape = [0]
index = 0
for _ in range(step_count):
order = blueprint[current_state][tape[index]]
tape[index] = order['write']
index += order['move']
current_state = order['continue']
if index < 0:
tape.insert(0, 0)
index = 0
if index == len(tape):
tape.append(0)
return sum(tape)
def part2(self) -> Any:
return ""
if __name__ == '__main__':
day = Day(2017, 25)
day.run(verbose=True)

1
inputs/input17 Normal file
View File

@ -0,0 +1 @@
359

1
inputs/input17_test Normal file
View File

@ -0,0 +1 @@
3

41
inputs/input18 Normal file
View File

@ -0,0 +1,41 @@
set i 31
set a 1
mul p 17
jgz p p
mul a 2
add i -1
jgz i -2
add a -1
set i 127
set p 826
mul p 8505
mod p a
mul p 129749
add p 12345
mod p a
set b p
mod b 10000
snd b
add i -1
jgz i -9
jgz a 3
rcv b
jgz b -1
set f 0
set i 126
rcv a
rcv b
set p a
mul p -1
add p b
jgz p 4
snd a
set a b
jgz 1 3
snd b
set f 1
add i -1
jgz i -11
snd a
jgz f -16
jgz a -19

10
inputs/input18_test Normal file
View File

@ -0,0 +1,10 @@
set a 1
add a 2
mul a a
mod a 5
snd a
set a 0
rcv a
jgz a -1
set a 1
jgz a -2

7
inputs/input18_test2 Normal file
View File

@ -0,0 +1,7 @@
snd 1
snd 2
snd p
rcv a
rcv b
rcv c
rcv d

201
inputs/input19 Normal file
View File

@ -0,0 +1,201 @@
|
+-------+ | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| | | | |
| | +--I------|---------------------------------------+ +--------------------------V----------+ +---------------+ +-------+ |
| | | | | | | | | | | | |
| | | | | | | +---|-------------------------|-------+ | | | |
| | | | | | | | | | | | | | |
| | | | | +-----------------|---------------------------------|---|-------------------------|---------------|---------------|-------|-----------+ |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | +-+ | +---------------------|---------------------------------------------------|---|-------------+ | | | +---------------------------|-+
| | | | | | | | | | | | | | | | | | | | | | |
| | +-|-----|-|-|-------------------------------------|-|-------------------------------------|-------------|-----------|-------|-------------------|---|-------|-----------|---|-+
| | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | +---------------|---------------------------+ | | | |
| | | | | | | | | | | | | | | | | | | | |
| +-+ | | +-|---+ +-----------|---------------------------------------------------------------------|------------Z------|-----------------------|-------------------|-----------+
| | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-+ | | +---------|---------------------------|---------------------------------------|-------------|---------------------------|---------------|-+ | +---------|---+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | |
+-+ | | | | | | | | | +---------------------------------------------------------------|-+ | | | +-------|-+ | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | |
T | | +---+ | | | | | | | | | | | | +-------+ | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-|---+ +-+ | +-|-----|---------------------|---+ | | | | | | | | | | | | +-|-------------------------------------------------+ +-------+
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | +---------------------------------------|---|---|-------|-|-----------------|---------------+ | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | +-|---|-----------+ +---------|-------|---+ | | | | +-------|---------------|-|---|-+ +-----|-----|-----------------|-+ | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-----------|---+ | | | | | | +-------|-----|-------------------------------------+ | | +---------|-------|-+ | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | +-----------------|-----|---------------------------------|-|-----+ | | | | | | +-------|-----+ | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | +---+ | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | +-----------------------------------|-----------------------------------|-------+ | | | | | | | | +-----------+ | | | +-------+ | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | +---------|-----+ | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +-|-----|-----|-|-|---|-------|---------------------|-----|---+ | | | | | | | | | +-------------------|-------+ +---+ | | | | +---------+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | +-------------------------------|-----+ | +-----------|-----+ | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | +---------|-----------|-----|-----------+ | | | +---+ | | | | | | | | | +-|---+ | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +---------|---------|-------|-------------+ | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | +-----|-----------------|-----------|---------------+ | | | | | | | | | +---+ | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | +---------------------|-----|-|-------|-----------|-+ | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-|---+ +---|-|---|---|-----------------------------|-----------------|-|-------------------|-----|-|-----|-|-------|-----------|-----|-----------|-|---|-----------|-----------|-|-|-|-+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | +-----+ | +-+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-|-+ | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +---+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------------|---------------|---|-----------|-------------|-+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-----------|---|---|---|-------|-+ | | | | | | | | | | | | | | | | | | | | | | | +-|---+ +-|-------+ | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +---|-----|---|-----|-------|-----------------|-------------|-------------|---------|---|-|-|---|-|-----|-|---|-----|---|---+ | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | +---------------------|-----|-|---|-|-----|-|-------|-----|-----|-----------|---|---|---|---|---------|-------|-----+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | +-----------------------|-------------|-----|-|---|---|-----|---------|---|---------|-------|---|---|---|---|-------|-|---+ | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | +-----|-------|-|---------+ | | | | | | | | | | | | | | | | +---------|-|-----|-+ | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | +-------|---|-----|-|-|-----|-----|-------------------|---+ | | | | | | | | | | | | | | | | | +---+
| | | | | | | | | | | | | | | J | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | +-|-|-|---|-|-------------------|---------+ | | | | | | | | +-----|-|---|---|---|-|-------+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-+ | | +-|-----|---+ | | | | | | | | | | | | | | | | | +-|-+ | |
| | | | | E | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | +-|-------|-------|---|-----|-----------|-----+ | +-----------|-----|---+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +---|-|-------|-------|---|-|-------|-------|-----|-|-----|---|-|-----|---|-------|---|---|-------|-|-----|-|-------|-----|-----------|-|---------|-----|-|-------|-|-|---|-+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +---------|-----|-----------|-|---|-----|---------|-|-|-|-|-------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+---+ | | | | | | | | | | | | | | | | | | +---|-|---|-+ | | | | | | | +-----|---|-|-|-|-|-+ | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | +-------|-------------------|---|-|-|-----------|-+ | | | | | | | +-|-|-|---|---|---|---|-|-----------------------+ | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | +-|-|-----|---------------------|-|-----|-----|-----|-------|---|-------|-|-----|-|-------------+ | | +---|-+ | +-------|-|-----------+ | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | +---------|-----|-|-------|---------|-----|-|-----|---|-----|-|-|---|-|-|---|-----|-----|-------+ | | +-|-------------+ | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-----+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-|---|-----|---------------|---------|---+ | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +---+ | | | | | | | | | | | | | | | | | +-|-|-|---|-+ | | | | | | +---|---|-----|-|---|-|---|-|-----------|-|-|---|-----|-----------|---------|-|-|-|-|---+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +---|---|---------|---|-|-|---|-|-------|---|---|-----|-------------|-------------|-----------|-|-----------|-|---|---|-|-----------|---+ | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-|-------|-------------|---|-|---------+ | | | | | | | +-----|---|---|-|-------|-|-----|-----+ +-------|---|-----|---+ | | +-|---------|-|-|---------|-|-----|-|-|-----------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-----|-----|---------------------|-------|-------|-------|-|---|F|-----|---|-|-|-----------|-|---|-----|-------------|-----------+ | | | | | | | | | | +-|---------------------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | +-----|-|---------|-----|-------------------|-|---|-----|-----|-----|-|-----------|-|---|---|-----|-|-----------|---------|-------|---|-------|---|---------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | +-|-+ | | | +---------------+ | | | | | | | | | +-|-|-|-+ | | | | | | +-----------+ | | | | +---+ | | | | | +---------|-|-|-+ | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +---|-------|-|-----+ | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-|-|-----------------|-------|-|---|---+ | +-|-|-------+ | | | | | | | | | | +-|-----+ | | | +-----|-------+ | | | +---+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-------|-------|---|-|-+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-------|-|-------|-|-|-|---|-------|---|---------+ | | | | | | | | | | | | | +-|---------|---|---|---------|-|-----|-|---------|-----|-|-|-|---------|-----|---------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | +---|-------|-------|-|-------|-----------|---------|---|-|-----------|-+ | | | | | | | | | | +-+ | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | +---|-|----------D|---------+ | | | +-+ | | | | +---|-----------------|-|-----|-----------|-|---|---|-|-|---|-----|---|-|---|-|---|-|-------|-+ +-+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | +---------------|-----|-|---+ | | +-|-----|---+ | | | | | | | | | | +-+ | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | +-|-----|---|-|-|---------------|-+ | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-----+ | +-|-------|-|-------|-----|-+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-|-------------------+ | | | | | | | | | | | | | +---|-----|-+ | | | | | | +-|-----|-----|-----+ | | +-----|-+ | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | +-------|-|---+ | | | +-+ | | | +-|-------------|-|-------------|-|---|-------|---------|-----------|-----------|-------|-----|-------|-----|-----+ | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | +---+ | +-----------|-+ | | | | | | +---|-|-----------|-------|-----------|-----|-----------|---|-------|-------------|-----|-------|-|-------|---------+ | +---|-|---+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | +-------|---|---|---------------|-----|-----|---------------|-|---------------|-------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +-+ | | | | | | | | | | | | +-------|-|---------|-|-|---|-------|---|-----------------|-|-|---------------|-------|-----|-----+ | +-------------------|-----+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | +-----------------------------------|-|-----|---------+ | | +-+ | +-----------|-+ | | | | | | +-----------------|-+ | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-----|-----+ | | | | | | | | | | | | | | | | | | +---|---------------------------------|-|-+ | | | | | | | +-----------|---|---|-|-+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | +-|-|-------------|---|-------------------------|-----|---------------|-+ | | | | | | | | +---------+ | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +---------------|-------|-|-----|---|---|---|-----------------|-|---------+ | | | +---------------------------------------|-----|---------+ | | | | | | | | | | | +-|---+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-----|-|-----|-------------------------------------|-|-------|-|---------------|---|---------|---|-|-|-----|---------------------|-|-------------------|-----+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | +-------------------------------------+ | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +-------------+ | +---|-----|---|---------------|-------------|-|-----|-------------------------+ | | | | | | | | | +-|---------|---+ | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-+ | | | | +---------+ | | +-------|-|---------------------------------------------|-----|-|-----|-------|-----------|-|-|-----------------+ | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | +---------+ | | | | | | | | | | | | | | | | | | | | | | +-----|---------|---|---|---|---|---------+ | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +---|---------------|-----|---+ | | | | | | | | | | | | | | | +---------------+ | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | +-------|-----|-|---------------------|-|--N--------|---------------+ | | | +-|-------------|-|-+ | | | | +---+ | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | +-----|-+ | +-----|-|-|-|---|---------------------|-------------|-|-----+ | | | | | | | | | +-------|---------|---|-----|-|---|-----------|-+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | W | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | +-------------+ | | | | | | | | +-+ +-------|---|-------|-------|-------------------|-|---|-------|---|---+ |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +---------|-----|-|-------|---|-|---|-------------------------|-------------------------------|-----|-----------------------|-----------|-+ | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | +-------------|-----------------------|---|-------|-----------------------|---------------------------|---------|-------+ +---|-------+ | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | +-|-|-----------|-|-|-|-----------------------|-|---|-------|-|---------------------|-------|-----+ | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+---+ | | | | | | | | | | | | | +-|---------------------|---------------------+ | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | +---|-----------+ | | | | | | | | | | | | | | | | | | +---|---------------------+ | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-----|-----|-+ | | | | | | | | +---------|-------+ +-----|---------------------------|-------|-|-----|-----|---|---|-----------+ | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-|---------|---------|---|-|---|---------------------|-|---------------------|-------------|-------------|---------|-+ | | | | +-----+ +---|---|-----|---------+ | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+-------------+ +---+ | | | | | | +-----------------------------------------------------------+ | | | | | | | +-----------|-|-------|---|---------------------+ | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | +---|---+ +-|---+ +-------------------------|-----------------------|---------------------------|-------------|-|-------------|-------------------|---------+ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| +-----------------+ | | | +-------+ | +-------------+ | | | +-|---|-|-------|---+ | +-------|---|-----+ | | |
| | | | | | | | | | | | | | | | | | | | | | | |
+-------------------------|---+ | +-----------------------|---------------------------+ | | | | +---+ +---|-+ | | +---------------------------+
| | | | | | | | | | | | | | | |
| +-------------------+ +-----------------------------------+ +-+ +-----------------|-|-|-----------+ | | +---------------+ |
| | | | | | | | | | | |
+-------------------------------------------------------------------+ +---------------------------------------+ +-+ +-----------------------+ +-------------------+ +-+

6
inputs/input19_test Normal file
View File

@ -0,0 +1,6 @@
|
| +--+
A | C
F---|----E|--+
| | | D
+B-+ +--+

1000
inputs/input20 Normal file

File diff suppressed because it is too large Load Diff

2
inputs/input20_test Normal file
View File

@ -0,0 +1,2 @@
p=< 3,0,0>, v=< 2,0,0>, a=<-1,0,0>
p=< 4,0,0>, v=< 0,0,0>, a=<-2,0,0>

4
inputs/input20_test2 Normal file
View File

@ -0,0 +1,4 @@
p=<-6,0,0>, v=< 3,0,0>, a=< 0,0,0>
p=<-4,0,0>, v=< 2,0,0>, a=< 0,0,0>
p=<-2,0,0>, v=< 1,0,0>, a=< 0,0,0>
p=< 3,0,0>, v=<-1,0,0>, a=< 0,0,0>

108
inputs/input21 Normal file
View File

@ -0,0 +1,108 @@
../.. => .#./.../###
#./.. => .#./##./#..
##/.. => #.#/#../###
.#/#. => ##./..#/###
##/#. => .#./#../..#
##/## => #../..#/#.#
.../.../... => .###/.#.#/.###/##.#
#../.../... => .##./##../##../#.##
.#./.../... => .#.#/#.#./..#./..#.
##./.../... => ###./#.##/...#/#.##
#.#/.../... => .#.#/.#../.###/.###
###/.../... => ..##/#.#./..../##.#
.#./#../... => #.../..../..../....
##./#../... => ...#/..#./.###/#.#.
..#/#../... => #.../#.##/###./##..
#.#/#../... => .##./#..#/#..#/..##
.##/#../... => .#.#/#.##/..##/.#.#
###/#../... => #.#./.###/..#./#.#.
.../.#./... => #..#/..../.##./.#.#
#../.#./... => .#../.##./.#.#/...#
.#./.#./... => ##.#/...#/.##./...#
##./.#./... => ..#./#.#./#.##/####
#.#/.#./... => ..##/#..#/.###/....
###/.#./... => .#../#..#/#.../..#.
.#./##./... => ..##/#.#./####/###.
##./##./... => ...#/.#../####/#..#
..#/##./... => ..##/##../###./....
#.#/##./... => ..##/#.../.#../.##.
.##/##./... => #.../##../#.##/...#
###/##./... => .#../####/#.##/#.##
.../#.#/... => #..#/####/###./#.#.
#../#.#/... => #.../##.#/#.../.#..
.#./#.#/... => ##.#/##.#/..#./..#.
##./#.#/... => .###/..#./.#../.###
#.#/#.#/... => .###/##../..#./..#.
###/#.#/... => ##../.#../.#../.#..
.../###/... => ..#./#.#./..#./#..#
#../###/... => ..../#.#./##.#/..##
.#./###/... => ..#./#.#./..##/.#..
##./###/... => .##./..##/#..#/#.#.
#.#/###/... => ###./###./#.##/..##
###/###/... => ##.#/..../.##./.#..
..#/.../#.. => .###/####/..../##.#
#.#/.../#.. => ##../###./#..#/...#
.##/.../#.. => ###./#..#/###./...#
###/.../#.. => #.../#..#/##.#/.##.
.##/#../#.. => ..##/####/..##/#...
###/#../#.. => #.../..../...#/..##
..#/.#./#.. => ####/#.#./..../.#.#
#.#/.#./#.. => .##./.#.#/##.#/.##.
.##/.#./#.. => ###./.#.#/###./##.#
###/.#./#.. => #.##/..##/#.#./##.#
.##/##./#.. => ..../..##/#.#./.##.
###/##./#.. => #.#./#..#/#..#/###.
#../..#/#.. => ..../####/#..#/.###
.#./..#/#.. => .###/#.../#.../#.##
##./..#/#.. => ####/##.#/###./####
#.#/..#/#.. => .#../##.#/#..#/#..#
.##/..#/#.. => ..##/##.#/#.##/###.
###/..#/#.. => ##.#/####/##.#/.#..
#../#.#/#.. => .###/#..#/.##./.###
.#./#.#/#.. => #.##/.##./.#../..#.
##./#.#/#.. => ###./..#./.##./##..
..#/#.#/#.. => .###/.#.#/#.#./##..
#.#/#.#/#.. => #..#/.###/.##./....
.##/#.#/#.. => ###./.###/#.##/.###
###/#.#/#.. => ####/.###/..../.##.
#../.##/#.. => ##.#/..../#.../..#.
.#./.##/#.. => #.../..../...#/###.
##./.##/#.. => ###./.#../..##/...#
#.#/.##/#.. => #.../...#/..#./.###
.##/.##/#.. => ###./..../##.#/...#
###/.##/#.. => ##.#/##../###./.##.
#../###/#.. => ..#./#.../..##/#.##
.#./###/#.. => ...#/.##./.#../.#..
##./###/#.. => ##.#/.#.#/###./....
..#/###/#.. => #.##/#.../####/.##.
#.#/###/#.. => .#.#/...#/#..#/..#.
.##/###/#.. => .##./#..#/#..#/.#.#
###/###/#.. => ###./####/#.##/#...
.#./#.#/.#. => ###./#..#/...#/...#
##./#.#/.#. => #.#./#.##/#.../#..#
#.#/#.#/.#. => .#.#/#.##/..../.#..
###/#.#/.#. => #.#./.#../.###/#.#.
.#./###/.#. => #.../.###/##../##.#
##./###/.#. => .###/#.../####/.#.#
#.#/###/.#. => #..#/####/#.#./#...
###/###/.#. => .#../..../.##./.#.#
#.#/..#/##. => ##../###./...#/###.
###/..#/##. => .##./###./.###/#.##
.##/#.#/##. => ..../##.#/#..#/#...
###/#.#/##. => .###/##../..../..#.
#.#/.##/##. => ####/.###/##../...#
###/.##/##. => #.##/..##/..#./#..#
.##/###/##. => ..../#.##/#.../#.##
###/###/##. => ..../#..#/#.##/#.##
#.#/.../#.# => #.../##.#/..../.#.#
###/.../#.# => ##../##../#.#./.##.
###/#../#.# => .##./.#../#.##/.##.
#.#/.#./#.# => #.../.#../####/#.##
###/.#./#.# => .###/##.#/#.../#.#.
###/##./#.# => .##./.##./.###/.#.#
#.#/#.#/#.# => ####/####/###./.##.
###/#.#/#.# => #.#./.###/...#/.#.#
#.#/###/#.# => .###/..#./..../.##.
###/###/#.# => #.#./##.#/..#./..#.
###/#.#/### => ###./#.../##../##..
###/###/### => ##.#/.#.#/#.#./...#

2
inputs/input21_test Normal file
View File

@ -0,0 +1,2 @@
../.# => ##./#../...
.#./..#/### => #..#/..../..../#..#

25
inputs/input22 Normal file
View File

@ -0,0 +1,25 @@
..######.###...######...#
.##..##.#....#..##.#....#
.##.#....###..##.###.#.#.
#.#.###.#####.###.##.##.#
.###.#.#.###.####..##.###
..####.##..#.#.#####...##
....##.###..#.#..#...####
.#.##.##.#..##...##.###..
.######..#..#.#####....##
###.##.###.########...###
.#.#.#..#.##.#..###...#..
.#.##.#.####.#.#.....###.
##..###.###..##...#.##.##
##.#.##..#...##...#...###
##..#..###.#..##.#.#.#.#.
.##.#####..##....#.#.#..#
..#.######.##...#..#.##..
#.##...#.#....###.#.##.#.
.#..#.#.#..#.####..#.####
.##...##....##..#.#.###..
..##.#.#.##..##.#.#....#.
###.###.######.#.########
..#.####.#.#.##..####...#
#.##..#.#.####...#..#..##
###.###.#..##..#.###....#

3
inputs/input22_test Normal file
View File

@ -0,0 +1,3 @@
..#
#..
...

32
inputs/input23 Normal file
View File

@ -0,0 +1,32 @@
set b 67
set c b
jnz a 2
jnz 1 5
mul b 100
sub b -100000
set c b
sub c -17000
set f 1
set d 2
set e 2
set g d
mul g e
sub g b
jnz g 2
set f 0
sub e -1
set g e
sub g b
jnz g -8
sub d -1
set g d
sub g b
jnz g -13
jnz f 2
sub h -1
set g b
sub g c
jnz g 2
jnz 1 3
sub b -17
jnz 1 -23

57
inputs/input24 Normal file
View File

@ -0,0 +1,57 @@
42/37
28/28
29/25
45/8
35/23
49/20
44/4
15/33
14/19
31/44
39/14
25/17
34/34
38/42
8/42
15/28
0/7
49/12
18/36
45/45
28/7
30/43
23/41
0/35
18/9
3/31
20/31
10/40
0/22
1/23
20/47
38/36
15/8
34/32
30/30
30/44
19/28
46/15
34/50
40/20
27/39
3/14
43/45
50/42
1/33
6/39
46/44
22/35
15/20
43/31
23/23
19/27
47/15
43/43
25/36
26/38
1/10

8
inputs/input24_test Normal file
View File

@ -0,0 +1,8 @@
0/2
2/2
2/3
3/4
3/5
0/1
10/1
9/10

62
inputs/input25 Normal file
View File

@ -0,0 +1,62 @@
Begin in state A.
Perform a diagnostic checksum after 12134527 steps.
In state A:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state B.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state C.
In state B:
If the current value is 0:
- Write the value 1.
- Move one slot to the left.
- Continue with state A.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state C.
In state C:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state D.
In state D:
If the current value is 0:
- Write the value 1.
- Move one slot to the left.
- Continue with state E.
If the current value is 1:
- Write the value 1.
- Move one slot to the left.
- Continue with state C.
In state E:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state F.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.
In state F:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state E.

22
inputs/input25_test Normal file
View File

@ -0,0 +1,22 @@
Begin in state A.
Perform a diagnostic checksum after 6 steps.
In state A:
If the current value is 0:
- Write the value 1.
- Move one slot to the right.
- Continue with state B.
If the current value is 1:
- Write the value 0.
- Move one slot to the left.
- Continue with state B.
In state B:
If the current value is 0:
- Write the value 1.
- Move one slot to the left.
- Continue with state A.
If the current value is 1:
- Write the value 1.
- Move one slot to the right.
- Continue with state A.