Compare commits
No commits in common. "220f2f6b68b786cae5a46f3c50c18b7997f626fa" and "17c3671974efb5fec960a037844ae7c985810e87" have entirely different histories.
220f2f6b68
...
17c3671974
|
@ -1,4 +0,0 @@
|
|||
if command -v nix-shell &> /dev/null
|
||||
then
|
||||
use flake
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
.direnv
|
||||
target
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1 +0,0 @@
|
|||
# Bootstrapping clojure project on
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1,3 +0,0 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
addx 15
|
||||
addx -11
|
||||
addx 6
|
||||
addx -3
|
||||
addx 5
|
||||
addx -1
|
||||
addx -8
|
||||
addx 13
|
||||
addx 4
|
||||
noop
|
||||
addx -1
|
||||
addx 5
|
||||
addx -1
|
||||
addx 5
|
||||
addx -1
|
||||
addx 5
|
||||
addx -1
|
||||
addx 5
|
||||
addx -1
|
||||
addx -35
|
||||
addx 1
|
||||
addx 24
|
||||
addx -19
|
||||
addx 1
|
||||
addx 16
|
||||
addx -11
|
||||
noop
|
||||
noop
|
||||
addx 21
|
||||
addx -15
|
||||
noop
|
||||
noop
|
||||
addx -3
|
||||
addx 9
|
||||
addx 1
|
||||
addx -3
|
||||
addx 8
|
||||
addx 1
|
||||
addx 5
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx -36
|
||||
noop
|
||||
addx 1
|
||||
addx 7
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 2
|
||||
addx 6
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 1
|
||||
noop
|
||||
noop
|
||||
addx 7
|
||||
addx 1
|
||||
noop
|
||||
addx -13
|
||||
addx 13
|
||||
addx 7
|
||||
noop
|
||||
addx 1
|
||||
addx -33
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 2
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 8
|
||||
noop
|
||||
addx -1
|
||||
addx 2
|
||||
addx 1
|
||||
noop
|
||||
addx 17
|
||||
addx -9
|
||||
addx 1
|
||||
addx 1
|
||||
addx -3
|
||||
addx 11
|
||||
noop
|
||||
noop
|
||||
addx 1
|
||||
noop
|
||||
addx 1
|
||||
noop
|
||||
noop
|
||||
addx -13
|
||||
addx -19
|
||||
addx 1
|
||||
addx 3
|
||||
addx 26
|
||||
addx -30
|
||||
addx 12
|
||||
addx -1
|
||||
addx 3
|
||||
addx 1
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx -9
|
||||
addx 18
|
||||
addx 1
|
||||
addx 2
|
||||
noop
|
||||
noop
|
||||
addx 9
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx -1
|
||||
addx 2
|
||||
addx -37
|
||||
addx 1
|
||||
addx 3
|
||||
noop
|
||||
addx 15
|
||||
addx -21
|
||||
addx 22
|
||||
addx -6
|
||||
addx 1
|
||||
noop
|
||||
addx 2
|
||||
addx 1
|
||||
noop
|
||||
addx -10
|
||||
noop
|
||||
noop
|
||||
addx 20
|
||||
addx 1
|
||||
addx 2
|
||||
addx 2
|
||||
addx -6
|
||||
addx -11
|
||||
noop
|
||||
noop
|
||||
noop
|
|
@ -1,143 +0,0 @@
|
|||
noop
|
||||
noop
|
||||
addx 5
|
||||
noop
|
||||
noop
|
||||
addx 6
|
||||
addx 4
|
||||
addx -4
|
||||
addx 4
|
||||
addx -6
|
||||
addx 11
|
||||
addx -1
|
||||
addx 2
|
||||
addx 4
|
||||
addx 3
|
||||
noop
|
||||
addx 2
|
||||
addx -30
|
||||
addx 2
|
||||
addx 33
|
||||
noop
|
||||
addx -37
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 3
|
||||
addx 2
|
||||
addx 5
|
||||
addx 20
|
||||
addx 7
|
||||
addx -24
|
||||
addx 2
|
||||
noop
|
||||
addx 7
|
||||
addx -2
|
||||
addx -6
|
||||
addx 13
|
||||
addx 3
|
||||
addx -2
|
||||
addx 2
|
||||
noop
|
||||
addx -5
|
||||
addx 10
|
||||
addx 5
|
||||
addx -39
|
||||
addx 1
|
||||
addx 5
|
||||
noop
|
||||
addx 3
|
||||
noop
|
||||
addx -5
|
||||
addx 10
|
||||
addx -2
|
||||
addx 2
|
||||
noop
|
||||
noop
|
||||
addx 7
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 3
|
||||
noop
|
||||
addx 3
|
||||
addx 2
|
||||
addx 8
|
||||
addx -1
|
||||
addx -20
|
||||
addx 21
|
||||
addx -38
|
||||
addx 5
|
||||
addx 2
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 8
|
||||
noop
|
||||
noop
|
||||
addx -2
|
||||
addx 2
|
||||
addx -7
|
||||
addx 14
|
||||
addx 5
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx -16
|
||||
addx 17
|
||||
addx 2
|
||||
addx -12
|
||||
addx 19
|
||||
noop
|
||||
noop
|
||||
addx -37
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 3
|
||||
addx 2
|
||||
addx 2
|
||||
addx 5
|
||||
addx 20
|
||||
addx -19
|
||||
addx 2
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 5
|
||||
addx 19
|
||||
addx -12
|
||||
addx 3
|
||||
addx -2
|
||||
addx 2
|
||||
addx -18
|
||||
addx 25
|
||||
addx -14
|
||||
addx -22
|
||||
addx 1
|
||||
noop
|
||||
noop
|
||||
noop
|
||||
addx 3
|
||||
addx 5
|
||||
addx -4
|
||||
addx 7
|
||||
addx 4
|
||||
noop
|
||||
addx 1
|
||||
noop
|
||||
noop
|
||||
addx 2
|
||||
addx -6
|
||||
addx 15
|
||||
addx -1
|
||||
addx 4
|
||||
noop
|
||||
noop
|
||||
addx 1
|
||||
addx 4
|
||||
addx -33
|
||||
noop
|
||||
addx 21
|
||||
noop
|
|
@ -1,94 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670064435,
|
||||
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670552927,
|
||||
"narHash": "sha256-lCE51eAGrAFS4k9W5aDGFpVtOAwQQ/rFMN80PCDh0vo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0fdafd18c9cf599fde17fbaf07dbb20fa57eecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
description = "Python + Rust workspace for AoC";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... } @ inputs:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
||||
let
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
pkgs = import nixpkgs { system = sys; overlays = overlays; };
|
||||
shellHookAfter = ''
|
||||
echo "The input files should be placed under ./data/{submission,example}.txt"
|
||||
echo "This problem shares one input between two parts"
|
||||
'';
|
||||
py_pkgs = [ pkgs.python310 ];
|
||||
rs_pkgs = [
|
||||
pkgs.openssl
|
||||
pkgs.pkg-config
|
||||
|
||||
# Add rust-src, which rust-analyzer seems to rely upon
|
||||
(pkgs.rust-bin.selectLatestNightlyWith
|
||||
(
|
||||
toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
}
|
||||
))
|
||||
# rust devex
|
||||
pkgs.bacon # kinda like nodemon
|
||||
pkgs.rust-analyzer
|
||||
];
|
||||
in
|
||||
{
|
||||
# Jack of all trades
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
buildInputs = py_pkgs ++ rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Default runtime. This contains both rust and python3 env"
|
||||
echo "Run ./run-py.sh for Python's output and ./run-rs.sh for Rust's output"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
devShells = {
|
||||
# nix develop ./#lua
|
||||
# lua = pkgs.mkShell {
|
||||
# nativeBuildInputs = lua_pkgs;
|
||||
# shellHook = ''
|
||||
# echo "> Lua runtime"
|
||||
# echo "Run ./run-lua.sh to see the output of the solution"
|
||||
# '' + shellHookAfter;
|
||||
# };
|
||||
|
||||
# nix develop ./#fennel
|
||||
|
||||
# nix develop ./#python
|
||||
rust = pkgs.mkShell {
|
||||
nativeBuildInputs = rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Rust runtime"
|
||||
echo "Run ./run-rs.sh to see output of the solution"
|
||||
echo "For quick feedback loop: bacon check-all"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
python = pkgs.mkShell {
|
||||
nativeBuildInputs = py_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Python3 runtime"
|
||||
echo "Run ./run-py.sh to see the output of the solution"
|
||||
'' + shellHookAfter;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
echo "example"
|
||||
python3 ./src/main.py ./data/example.txt
|
||||
|
||||
echo "submission"
|
||||
python3 ./src/main.py ./data/submission.txt
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from typing import Iterable
|
||||
import os
|
||||
|
||||
def part1(insns: list[list[str]], init = 1):
|
||||
reg = init
|
||||
regs = [reg]
|
||||
for insn in insns:
|
||||
match insn:
|
||||
case ["noop"]:
|
||||
regs.append(regs[-1])
|
||||
case ["addx", adder]:
|
||||
reg += int(adder)
|
||||
regs.append(regs[-1])
|
||||
regs.append(reg)
|
||||
case e:
|
||||
raise RuntimeError(f"lol what case is this? {e=}")
|
||||
print("regs", os.pathsep.join(str(reg) for reg in regs))
|
||||
|
||||
def ret(queries: Iterable[int]):
|
||||
signal_bases = [(i, regs[i-1]) for i in queries]
|
||||
print(signal_bases)
|
||||
return sum(signal[0] * signal[1] for signal in signal_bases)
|
||||
return (regs, ret)
|
||||
|
||||
def part2(insns: list[list[str]], init = 1, width = 40):
|
||||
regs, _ = part1(insns, init)
|
||||
position = lambda cycle: (cycle) % width
|
||||
active = [['#' if (position(cycle) in range(regs[cycle]-1, regs[cycle]+2)) else '.'
|
||||
for cycle in range(row, min(row + width, len(regs)))]
|
||||
for row in range(0, len(regs),width)]
|
||||
return active
|
||||
|
||||
def main(lines: Iterable[str]):
|
||||
instructions = [s.split() for s in (line.strip() for line in lines) if len(s) > 0]
|
||||
# print("part1", part1(instructions)([1,2,3,4,5]))
|
||||
print("part1", part1(instructions)[1]([20, 60, 100, 140, 180, 220]))
|
||||
part2_ans = part2(instructions)
|
||||
print("part2")
|
||||
for line in part2_ans:
|
||||
print(str().join(line))
|
||||
pass
|
||||
|
||||
|
||||
def _main(filename: str):
|
||||
with open(filename, "r") as f:
|
||||
main(f)
|
||||
|
||||
if __name__=="__main__":
|
||||
_main(sys.argv[1])
|
||||
|
||||
# For neovim integrated repl which can evaluate per selection
|
||||
REPL = """
|
||||
_main("./data/example.txt")
|
||||
_main("./data/submission.txt")
|
||||
main([
|
||||
"noop",
|
||||
"addx 3",
|
||||
"addx -5"
|
||||
])
|
||||
|
||||
[1, 1, 1, 4, 4, -1, -1, -6, -6]
|
||||
|
||||
"""
|
|
@ -1,6 +0,0 @@
|
|||
fn main() {
|
||||
// let test = include_str!("../data/example.txt");
|
||||
let sub = inlcude_str!("../data/submission.txt");
|
||||
let commands = sub.lines()
|
||||
.map(|line| line.split(" "))
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
if command -v nix-shell &> /dev/null
|
||||
then
|
||||
use flake
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
.direnv
|
||||
target
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +0,0 @@
|
|||
[package]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dev-dependencies]
|
||||
bacon = "2.2.8"
|
||||
rstest = "0.16.0"
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.10.5"
|
|
@ -1 +0,0 @@
|
|||
# Bootstrapping clojure project on
|
|
@ -1,27 +0,0 @@
|
|||
Monkey 0:
|
||||
Starting items: 79, 98
|
||||
Operation: new = old * 19
|
||||
Test: divisible by 23
|
||||
If true: throw to monkey 2
|
||||
If false: throw to monkey 3
|
||||
|
||||
Monkey 1:
|
||||
Starting items: 54, 65, 75, 74
|
||||
Operation: new = old + 6
|
||||
Test: divisible by 19
|
||||
If true: throw to monkey 2
|
||||
If false: throw to monkey 0
|
||||
|
||||
Monkey 2:
|
||||
Starting items: 79, 60, 97
|
||||
Operation: new = old * old
|
||||
Test: divisible by 13
|
||||
If true: throw to monkey 1
|
||||
If false: throw to monkey 3
|
||||
|
||||
Monkey 3:
|
||||
Starting items: 74
|
||||
Operation: new = old + 3
|
||||
Test: divisible by 17
|
||||
If true: throw to monkey 0
|
||||
If false: throw to monkey 1
|
|
@ -1,55 +0,0 @@
|
|||
Monkey 0:
|
||||
Starting items: 59, 65, 86, 56, 74, 57, 56
|
||||
Operation: new = old * 17
|
||||
Test: divisible by 3
|
||||
If true: throw to monkey 3
|
||||
If false: throw to monkey 6
|
||||
|
||||
Monkey 1:
|
||||
Starting items: 63, 83, 50, 63, 56
|
||||
Operation: new = old + 2
|
||||
Test: divisible by 13
|
||||
If true: throw to monkey 3
|
||||
If false: throw to monkey 0
|
||||
|
||||
Monkey 2:
|
||||
Starting items: 93, 79, 74, 55
|
||||
Operation: new = old + 1
|
||||
Test: divisible by 2
|
||||
If true: throw to monkey 0
|
||||
If false: throw to monkey 1
|
||||
|
||||
Monkey 3:
|
||||
Starting items: 86, 61, 67, 88, 94, 69, 56, 91
|
||||
Operation: new = old + 7
|
||||
Test: divisible by 11
|
||||
If true: throw to monkey 6
|
||||
If false: throw to monkey 7
|
||||
|
||||
Monkey 4:
|
||||
Starting items: 76, 50, 51
|
||||
Operation: new = old * old
|
||||
Test: divisible by 19
|
||||
If true: throw to monkey 2
|
||||
If false: throw to monkey 5
|
||||
|
||||
Monkey 5:
|
||||
Starting items: 77, 76
|
||||
Operation: new = old + 8
|
||||
Test: divisible by 17
|
||||
If true: throw to monkey 2
|
||||
If false: throw to monkey 1
|
||||
|
||||
Monkey 6:
|
||||
Starting items: 74
|
||||
Operation: new = old * 2
|
||||
Test: divisible by 5
|
||||
If true: throw to monkey 4
|
||||
If false: throw to monkey 7
|
||||
|
||||
Monkey 7:
|
||||
Starting items: 86, 85, 52, 86, 91, 95
|
||||
Operation: new = old + 6
|
||||
Test: divisible by 7
|
||||
If true: throw to monkey 4
|
||||
If false: throw to monkey 5
|
|
@ -1,94 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670064435,
|
||||
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670552927,
|
||||
"narHash": "sha256-lCE51eAGrAFS4k9W5aDGFpVtOAwQQ/rFMN80PCDh0vo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0fdafd18c9cf599fde17fbaf07dbb20fa57eecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
description = "Python + Rust workspace for AoC";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... } @ inputs:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
||||
let
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
pkgs = import nixpkgs { system = sys; overlays = overlays; };
|
||||
shellHookAfter = ''
|
||||
echo "The input files should be placed under ./data/{submission,example}.txt"
|
||||
echo "This problem shares one input between two parts"
|
||||
'';
|
||||
py_pkgs = [ pkgs.python310 ];
|
||||
rs_pkgs = [
|
||||
pkgs.openssl
|
||||
pkgs.pkg-config
|
||||
|
||||
# Add rust-src, which rust-analyzer seems to rely upon
|
||||
(pkgs.rust-bin.selectLatestNightlyWith
|
||||
(
|
||||
toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
}
|
||||
))
|
||||
# rust devex
|
||||
pkgs.bacon # kinda like nodemon
|
||||
pkgs.rust-analyzer
|
||||
];
|
||||
in
|
||||
{
|
||||
# Jack of all trades
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
buildInputs = py_pkgs ++ rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Default runtime. This contains both rust and python3 env"
|
||||
echo "Run ./run-py.sh for Python's output and ./run-rs.sh for Rust's output"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
devShells = {
|
||||
# nix develop ./#lua
|
||||
# lua = pkgs.mkShell {
|
||||
# nativeBuildInputs = lua_pkgs;
|
||||
# shellHook = ''
|
||||
# echo "> Lua runtime"
|
||||
# echo "Run ./run-lua.sh to see the output of the solution"
|
||||
# '' + shellHookAfter;
|
||||
# };
|
||||
|
||||
# nix develop ./#fennel
|
||||
|
||||
# nix develop ./#python
|
||||
rust = pkgs.mkShell {
|
||||
nativeBuildInputs = rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Rust runtime"
|
||||
echo "Run ./run-rs.sh to see output of the solution"
|
||||
echo "For quick feedback loop: bacon check-all"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
python = pkgs.mkShell {
|
||||
nativeBuildInputs = py_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Python3 runtime"
|
||||
echo "Run ./run-py.sh to see the output of the solution"
|
||||
'' + shellHookAfter;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
echo "example"
|
||||
python3 ./src/main.py ./data/example.txt
|
||||
|
||||
echo "submission"
|
||||
python3 ./src/main.py ./data/submission.txt
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from typing import Iterable
|
||||
import os
|
||||
|
||||
def part1(insns: list[list[str]], init = 1):
|
||||
reg = init
|
||||
regs = [reg]
|
||||
for insn in insns:
|
||||
match insn:
|
||||
case ["noop"]:
|
||||
regs.append(regs[-1])
|
||||
case ["addx", adder]:
|
||||
reg += int(adder)
|
||||
regs.append(regs[-1])
|
||||
regs.append(reg)
|
||||
case e:
|
||||
raise RuntimeError(f"lol what case is this? {e=}")
|
||||
print("regs", os.pathsep.join(str(reg) for reg in regs))
|
||||
|
||||
def ret(queries: Iterable[int]):
|
||||
signal_bases = [(i, regs[i-1]) for i in queries]
|
||||
print(signal_bases)
|
||||
return sum(signal[0] * signal[1] for signal in signal_bases)
|
||||
return (regs, ret)
|
||||
|
||||
def part2(insns: list[list[str]], init = 1, width = 40):
|
||||
regs, _ = part1(insns, init)
|
||||
position = lambda cycle: (cycle) % width
|
||||
active = [['#' if (position(cycle) in range(regs[cycle]-1, regs[cycle]+2)) else '.'
|
||||
for cycle in range(row, min(row + width, len(regs)))]
|
||||
for row in range(0, len(regs),width)]
|
||||
return active
|
||||
|
||||
def main(lines: Iterable[str]):
|
||||
instructions = [s.split() for s in (line.strip() for line in lines) if len(s) > 0]
|
||||
# print("part1", part1(instructions)([1,2,3,4,5]))
|
||||
print("part1", part1(instructions)[1]([20, 60, 100, 140, 180, 220]))
|
||||
part2_ans = part2(instructions)
|
||||
print("part2")
|
||||
for line in part2_ans:
|
||||
print(str().join(line))
|
||||
pass
|
||||
|
||||
|
||||
def _main(filename: str):
|
||||
with open(filename, "r") as f:
|
||||
main(f)
|
||||
|
||||
if __name__=="__main__":
|
||||
_main(sys.argv[1])
|
||||
|
||||
# For neovim integrated repl which can evaluate per selection
|
||||
REPL = """
|
||||
_main("./data/example.txt")
|
||||
_main("./data/submission.txt")
|
||||
main([
|
||||
"noop",
|
||||
"addx 3",
|
||||
"addx -5"
|
||||
])
|
||||
|
||||
[1, 1, 1, 4, 4, -1, -1, -6, -6]
|
||||
|
||||
"""
|
|
@ -1,292 +0,0 @@
|
|||
use core::result;
|
||||
use std::collections::VecDeque;
|
||||
use std::iter::Iterator;
|
||||
use std::num::Wrapping;
|
||||
use std::ops::{Add, Div, Mul, Sub};
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
fn ex_case() -> &'static str {
|
||||
include_str!("../data/example.txt")
|
||||
}
|
||||
fn sub_case() -> &'static str {
|
||||
include_str!("../data/submission.txt")
|
||||
}
|
||||
|
||||
fn process_input(input_str: &str) -> Result<Vec<Monkey>> {
|
||||
Ok(collect_errs(parse_universe(input_str))
|
||||
.map_err(|e| e.collect_vec().join("\n"))?
|
||||
.collect_vec())
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
// let test = include_str!("../data/example.txt");
|
||||
let sub = sub_case();
|
||||
let universe = process_input(sub)?;
|
||||
|
||||
println!("part1: {}", part1(universe.iter()));
|
||||
part2(universe.iter());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// If there exists an [`Err`] in [`results`], this function filters out so that
|
||||
/// it only returns Err values. Otherwise, returns [`Ok`]
|
||||
fn collect_errs<T, E, ResultIter: Iterator<Item = core::result::Result<T, E>>>(
|
||||
results: ResultIter,
|
||||
) -> result::Result<impl Iterator<Item = T>, impl Iterator<Item = E>> {
|
||||
let v = results.collect_vec();
|
||||
let has_err = v.iter().any(|res| res.is_err());
|
||||
if has_err {
|
||||
Err(v.into_iter().filter_map(|e| e.err()))
|
||||
} else {
|
||||
Ok(v.into_iter().filter_map(|e| e.ok()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Allows for lazy results
|
||||
trait CanResult {
|
||||
type T;
|
||||
type E;
|
||||
fn result(self) -> result::Result<Self::T, Self::E>;
|
||||
}
|
||||
|
||||
impl <T, E> CanResult for core::result::Result<T, E> {
|
||||
type T = T;
|
||||
type E = E;
|
||||
fn result(self) -> result::Result<Self::T, Self::E> {self}
|
||||
}
|
||||
|
||||
trait CollectErrs {
|
||||
type T;
|
||||
type E;
|
||||
type IterT: Iterator<Item=Self::T>;
|
||||
type IterE: Iterator<Item=Self::E>;
|
||||
type R: CanResult<T=Self::IterT, E=Self::IterE>;
|
||||
fn collect_errs(self) -> Self::R;
|
||||
}
|
||||
|
||||
struct CollectErrsResult<T, E, ResIter: Iterator<Item=core::result::Result<T,E>>> {
|
||||
input: ResIter
|
||||
}
|
||||
|
||||
|
||||
impl <T, E, ResIter: Iterator<Item=core::result::Result<T,E>>> CanResult for CollectErrsResult<T, E, ResIter> {
|
||||
fn result(self) -> result::Result<Self::T, Self::E> {
|
||||
let v = self.input.collect_vec();
|
||||
let has_err = v.iter().any(|res| res.is_err());
|
||||
if has_err {
|
||||
Err(v.into_iter().filter_map(|e| e.err()))
|
||||
} else {
|
||||
Ok(v.into_iter().filter_map(|e| e.ok()))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<T, E, ResIter: Iterator<Item=core::result::Result<T,E>>>
|
||||
CollectErrs for ResIter
|
||||
{
|
||||
type T = T;
|
||||
type E = E;
|
||||
type IterT;
|
||||
type IterE;
|
||||
|
||||
fn collect_errs(self) -> result::Result<Self::IterT, Self::IterE> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// <T, E, ResultIter: Iterator<Item=core::result::Result<T, E>>>
|
||||
fn part1<'a>(universe: impl Iterator<Item = &'a Monkey>) -> u32 {
|
||||
todo!();
|
||||
}
|
||||
fn part2<'a>(universe: impl Iterator<Item = &'a Monkey>) {
|
||||
todo!();
|
||||
}
|
||||
|
||||
type MyErr = String;
|
||||
type Result<T> = core::result::Result<T, MyErr>;
|
||||
|
||||
type Int = Wrapping<u32>;
|
||||
|
||||
trait TypeContainer<T> {
|
||||
type ContainedType; // AssociatedType default is unstable
|
||||
}
|
||||
|
||||
impl<T> TypeContainer<T> for Wrapping<T> {
|
||||
type ContainedType = T;
|
||||
}
|
||||
|
||||
trait MonadFrom<T>: TypeContainer<T> {
|
||||
fn monad_ctor(t: T) -> Self;
|
||||
}
|
||||
|
||||
// impl <T, Contained> MonadFrom<Contained> for T where T: TypeContainer<Contained> {
|
||||
// fn monad_ctor(t: Contained) -> Self {
|
||||
// Self(t) // The Self constructor can only be used with tuple or unit structs
|
||||
// }
|
||||
// }
|
||||
|
||||
impl<T> MonadFrom<T> for Wrapping<T> {
|
||||
fn monad_ctor(t: T) -> Self {
|
||||
Self(t)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum MonkeyOperator {
|
||||
Const(Int),
|
||||
Id,
|
||||
ConstOp {
|
||||
my_const: Int,
|
||||
op: fn(Int, Int) -> Int,
|
||||
},
|
||||
SelfOp(fn(Int, Int) -> Int),
|
||||
}
|
||||
impl MonkeyOperator {
|
||||
fn apply(&self, old: Int) -> Int {
|
||||
match &self {
|
||||
Self::Const(e) => *e,
|
||||
Self::Id => old,
|
||||
Self::ConstOp { my_const, op } => op(*my_const, old),
|
||||
Self::SelfOp(op) => op(old, old),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Parses the expression `"new"{ }"="{ }<rval_tok>[{ }<op>{ }<rval_tok>]`
|
||||
fn parse_monkey_op(input: &str) -> Result<MonkeyOperator> {
|
||||
// should be in the following format: old <op> <rval>
|
||||
fn _op_parse(op: &str) -> Result<fn(Int, Int) -> Int> {
|
||||
match op {
|
||||
"*" => Ok(Int::mul),
|
||||
"/" => Ok(Int::div),
|
||||
"+" => Ok(Int::add),
|
||||
"-" => Ok(Int::sub),
|
||||
e => Err(format!("idk wtf is the case with {e}")),
|
||||
}
|
||||
}
|
||||
fn _parse(v: Vec<&str>) -> Result<MonkeyOperator> {
|
||||
match &v[..2] {
|
||||
["new", "="] => Ok(()),
|
||||
_ => Err(format!(
|
||||
"monkey operation expr should start with \"new = \""
|
||||
)),
|
||||
}?;
|
||||
match &v[2..] {
|
||||
["old"] => Ok(MonkeyOperator::Id),
|
||||
// I want Int::ContainedType so bad :(
|
||||
[e] => e
|
||||
.parse::<<Int as TypeContainer<_>>::ContainedType>()
|
||||
.map(|e| MonkeyOperator::Const(Int::monad_ctor(e)))
|
||||
.map_err(|e| e.to_string()),
|
||||
e => Err(format!("idk wtf is the case with {:?}", e)),
|
||||
}
|
||||
}
|
||||
_parse(input.split_whitespace().collect_vec())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Monkey {
|
||||
monkey_id: u8,
|
||||
worry_q: VecDeque<u32>,
|
||||
operation: MonkeyOperator,
|
||||
worry_divcheck: u32,
|
||||
dest_div: usize, // if divisble by worry_divcheck, which monkey to throw to?
|
||||
dest_not_div: usize, // if not divisible, which monkey to throw to?
|
||||
}
|
||||
|
||||
/// Turns the monkey's input as specified in ../data/example.txt
|
||||
/// into Monkey
|
||||
fn parse_monkey(monkey_input: &str) -> Result<Monkey> {
|
||||
let mut spl = monkey_input.lines();
|
||||
// "Monkey 0"
|
||||
let monkey_id = spl
|
||||
.next()
|
||||
.and_then(|id_str| id_str.split(' ').last())
|
||||
// "0:" \in possible(id)
|
||||
.map(|id| id.chars().take(id.len() - 1))
|
||||
.ok_or_else(|| "Failed to parse monkey id input".to_string())
|
||||
// "0"
|
||||
.and_then(|id| {
|
||||
id.collect::<String>()
|
||||
.parse::<u8>()
|
||||
.map_err(|e| e.to_string())
|
||||
})?;
|
||||
// | Starting items: [item{, item}]
|
||||
let worry_q = spl
|
||||
.next()
|
||||
.and_then(|id_str| id_str.split(": ").last())
|
||||
.map(|s| s.split(", "))
|
||||
.ok_or_else(|| "Failed to parse worry_q".to_string())?;
|
||||
.and_then(|int_spl| int_spl.map(|int_s| int_s.parse::<u32>()))
|
||||
.map(|worries| worries.collect::<VecDeque<_>>())
|
||||
let operation = spl
|
||||
.next()
|
||||
.and_then(|op_line| op_line.split(": ").last())
|
||||
.ok_or_else(|| "Failed to parse monkey operation".to_string())
|
||||
.and_then(|op_str| parse_monkey_op(op_str))?;
|
||||
let worry_divcheck = spl
|
||||
.next()
|
||||
.and_then(|div_test_ln| div_test_ln.split_whitespace().last())
|
||||
.ok_or_else(|| "Failed to parse divisible test value".to_string())
|
||||
.and_then(|div_str| div_str.parse::<u32>().map_err(|e| e.to_string()))?;
|
||||
let mut parse_monkey_idx_div = || {
|
||||
spl.next()
|
||||
.and_then(|ln| ln.split_whitespace().last())
|
||||
.ok_or_else(|| "Failed to parse which monkey index to throw if divisible".to_string())
|
||||
.and_then(|div_str| div_str.parse::<usize>().map_err(|e| e.to_string()))
|
||||
};
|
||||
let dest_div = parse_monkey_idx_div()?;
|
||||
let dest_no_div = parse_monkey_idx_div()?;
|
||||
Monkey {
|
||||
monkey_id,
|
||||
worry_q,
|
||||
operation,
|
||||
worry_divcheck,
|
||||
dest_div,
|
||||
dest_no_div,
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_universe<'a>(input: &'a str) -> impl Iterator<Item = Result<Monkey>> + 'a + Clone {
|
||||
input.split("\n\n").map(parse_monkey)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn part1_example() {
|
||||
assert_eq!(part1((process_input(ex_case())).unwrap()));
|
||||
}
|
||||
#[test]
|
||||
fn part2_example() {}
|
||||
|
||||
#[rstest::rstest]
|
||||
#[case(0)]
|
||||
#[case(1)]
|
||||
#[case(2)]
|
||||
#[case(3)]
|
||||
#[case(414)]
|
||||
fn parse_monkeyop_id(#[case] input: u32) {
|
||||
let id = parse_monkey_op("new = old").unwrap();
|
||||
assert_eq!(id.apply(Int::monad_ctor(input)), Int::monad_ctor(input));
|
||||
}
|
||||
#[rstest::rstest]
|
||||
#[case(0, 14)]
|
||||
#[case(0, 1)]
|
||||
#[case(0, 7)]
|
||||
#[case(7, 14)]
|
||||
#[case(7, 69)]
|
||||
fn parse_monkey_op_const(#[case] my_const: u32, #[case] ignored_old_val: u32) {
|
||||
let const_ret = parse_monkey_op(format!("new = {my_const}").as_str()).unwrap();
|
||||
assert_eq!(
|
||||
const_ret.apply(Int::monad_ctor(ignored_old_val)),
|
||||
Int::monad_ctor(my_const)
|
||||
);
|
||||
}
|
||||
|
||||
// #[test]
|
||||
// fn panic() {
|
||||
// panic!("lol")
|
||||
// }
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
if command -v nix-shell &> /dev/null
|
||||
then
|
||||
use flake
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
.direnv
|
||||
target
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1 +0,0 @@
|
|||
# Bootstrapping clojure project on
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1,3 +0,0 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
498,4 -> 498,6 -> 496,6
|
||||
503,4 -> 502,4 -> 502,9 -> 494,9
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
507,19 -> 511,19
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
494,34 -> 499,34
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
490,31 -> 495,31
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
497,108 -> 501,108
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
482,25 -> 487,25
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
517,79 -> 522,79
|
||||
498,17 -> 502,17
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
479,28 -> 484,28
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
501,19 -> 505,19
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
501,15 -> 505,15
|
||||
511,60 -> 522,60
|
||||
509,108 -> 513,108
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
513,76 -> 518,76
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
497,31 -> 502,31
|
||||
501,34 -> 506,34
|
||||
503,134 -> 512,134 -> 512,133
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
500,99 -> 504,99
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
514,82 -> 519,82
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
495,15 -> 499,15
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
498,13 -> 502,13
|
||||
485,22 -> 490,22
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
511,85 -> 516,85
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
473,34 -> 478,34
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
483,31 -> 488,31
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
500,105 -> 504,105
|
||||
521,82 -> 526,82
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
503,102 -> 507,102
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
487,34 -> 492,34
|
||||
503,108 -> 507,108
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
489,25 -> 494,25
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
492,17 -> 496,17
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
495,19 -> 499,19
|
||||
504,85 -> 509,85
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
508,150 -> 521,150
|
||||
507,82 -> 512,82
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
480,34 -> 485,34
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
506,105 -> 510,105
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
503,134 -> 512,134 -> 512,133
|
||||
497,102 -> 501,102
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
489,19 -> 493,19
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
517,73 -> 517,69 -> 517,73 -> 519,73 -> 519,71 -> 519,73 -> 521,73 -> 521,72 -> 521,73 -> 523,73 -> 523,69 -> 523,73 -> 525,73 -> 525,69 -> 525,73 -> 527,73 -> 527,65 -> 527,73
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
486,28 -> 491,28
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
491,108 -> 495,108
|
||||
476,31 -> 481,31
|
||||
508,56 -> 508,49 -> 508,56 -> 510,56 -> 510,51 -> 510,56 -> 512,56 -> 512,49 -> 512,56 -> 514,56 -> 514,52 -> 514,56
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
525,85 -> 530,85
|
||||
510,163 -> 524,163 -> 524,162
|
||||
482,121 -> 482,120 -> 482,121 -> 484,121 -> 484,113 -> 484,121 -> 486,121 -> 486,115 -> 486,121 -> 488,121 -> 488,114 -> 488,121 -> 490,121 -> 490,120 -> 490,121 -> 492,121 -> 492,116 -> 492,121 -> 494,121 -> 494,112 -> 494,121 -> 496,121 -> 496,120 -> 496,121
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
504,17 -> 508,17
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
521,153 -> 521,155 -> 519,155 -> 519,158 -> 530,158 -> 530,155 -> 525,155 -> 525,153
|
||||
493,28 -> 498,28
|
||||
494,105 -> 498,105
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
495,124 -> 495,127 -> 489,127 -> 489,131 -> 503,131 -> 503,127 -> 500,127 -> 500,124
|
||||
507,88 -> 507,91 -> 503,91 -> 503,96 -> 519,96 -> 519,91 -> 513,91 -> 513,88
|
||||
510,79 -> 515,79
|
||||
510,163 -> 524,163 -> 524,162
|
||||
478,37 -> 478,39 -> 474,39 -> 474,43 -> 487,43 -> 487,39 -> 480,39 -> 480,37
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
518,85 -> 523,85
|
||||
492,147 -> 492,138 -> 492,147 -> 494,147 -> 494,140 -> 494,147 -> 496,147 -> 496,138 -> 496,147 -> 498,147 -> 498,143 -> 498,147 -> 500,147 -> 500,137 -> 500,147 -> 502,147 -> 502,137 -> 502,147 -> 504,147 -> 504,146 -> 504,147 -> 506,147 -> 506,145 -> 506,147 -> 508,147 -> 508,138 -> 508,147 -> 510,147 -> 510,143 -> 510,147
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670064435,
|
||||
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670552927,
|
||||
"narHash": "sha256-lCE51eAGrAFS4k9W5aDGFpVtOAwQQ/rFMN80PCDh0vo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0fdafd18c9cf599fde17fbaf07dbb20fa57eecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
description = "D4 AOC with Lua!";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... } @ inputs:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
||||
let
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
pkgs = import nixpkgs { system = sys; overlays = overlays; };
|
||||
shellHookAfter = ''
|
||||
echo "The input files should be placed under ./data/{submission,example}.txt"
|
||||
echo "This problem shares one input between two parts"
|
||||
'';
|
||||
py_pkgs = [ pkgs.python310 ];
|
||||
rs_pkgs = [
|
||||
pkgs.openssl
|
||||
pkgs.pkg-config
|
||||
|
||||
# Add rust-src, which rust-analyzer seems to rely upon
|
||||
(pkgs.rust-bin.selectLatestNightlyWith
|
||||
(
|
||||
toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
}
|
||||
))
|
||||
# rust devex
|
||||
pkgs.bacon # kinda like nodemon
|
||||
pkgs.rust-analyzer
|
||||
];
|
||||
in
|
||||
{
|
||||
# Jack of all trades
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
buildInputs = py_pkgs ++ rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Default runtime. This contains both rust and python3 env"
|
||||
echo "Run ./run-py.sh for Python's output and ./run-rs.sh for Rust's output"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
devShells = {
|
||||
# nix develop ./#lua
|
||||
# lua = pkgs.mkShell {
|
||||
# nativeBuildInputs = lua_pkgs;
|
||||
# shellHook = ''
|
||||
# echo "> Lua runtime"
|
||||
# echo "Run ./run-lua.sh to see the output of the solution"
|
||||
# '' + shellHookAfter;
|
||||
# };
|
||||
|
||||
# nix develop ./#fennel
|
||||
|
||||
# nix develop ./#python
|
||||
rust = pkgs.mkShell {
|
||||
nativeBuildInputs = rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Rust runtime"
|
||||
echo "Run ./run-rs.sh to see output of the solution"
|
||||
echo "For quick feedback loop: bacon check-all"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
python = pkgs.mkShell {
|
||||
nativeBuildInputs = py_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Python3 runtime"
|
||||
echo "Run ./run-py.sh to see the output of the solution"
|
||||
'' + shellHookAfter;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
echo "example"
|
||||
python3 ./src/d9.py ./data/example.txt
|
||||
|
||||
echo "submission"
|
||||
python3 ./src/d9.py ./data/submission.txt
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from typing import Iterable
|
||||
|
||||
def add_nd(lhs: Iterable[int], rhs: Iterable[int]):
|
||||
# Add two generic n-d vector together
|
||||
return tuple(l + r for l, r in zip(lhs, rhs))
|
||||
def negate_nd(vec: Iterable[int]):
|
||||
# Negates a generic n-d vector
|
||||
return tuple(-e for e in vec)
|
||||
def norm_infk_nd(vec: Iterable[int]):
|
||||
# Mathematical concept where I get the length of the longest vector component
|
||||
return max(abs(e) for e in vec)
|
||||
def sign(e: int):
|
||||
return 0 if e == 0 else (1 if e > 0 else -1)
|
||||
|
||||
def dir_to_offset(dir: str):
|
||||
match dir:
|
||||
case "U":
|
||||
return (0, 1)
|
||||
case "D":
|
||||
return (0, -1)
|
||||
case "L":
|
||||
return (-1, 0)
|
||||
case "R":
|
||||
return (1, 0)
|
||||
case d:
|
||||
raise RuntimeError(f"Unknown direction {d}")
|
||||
|
||||
def move_knot(knot: list[tuple[int, int]], offset: Iterable[int]):
|
||||
knot.append(add_nd(knot[-1], offset))
|
||||
return knot
|
||||
|
||||
def part1(commands: list[tuple[str, int]]):
|
||||
tail_locs: list[tuple[int, int]] = [(0,0)] # keeps track of where tail moved
|
||||
# NOTE: I don't need to keep track of head's history here. This is only
|
||||
# for ease of debugging
|
||||
head_locs : list[tuple[int, int]] = [(0,0)] # keeps track of where head moved
|
||||
for dir, rep in commands:
|
||||
for _ in range(rep):
|
||||
move_knot(head_locs, dir_to_offset(dir))
|
||||
offset = add_nd(head_locs[-1], negate_nd(tail_locs[-1]))
|
||||
# print(f"{offset=}")
|
||||
if norm_infk_nd(offset) <= 1:
|
||||
continue # no need to catch up
|
||||
move_knot(tail_locs, (sign(e) for e in offset))
|
||||
# print(f"{tail_locs=}")
|
||||
# print(f"{head_locs=}")
|
||||
return len(set(tail_locs))
|
||||
|
||||
def part2(commands: list[tuple[str, int]]):
|
||||
KNOTS = 10
|
||||
# NOTE: I don't need to keep track of any history but tail's. This is only
|
||||
# for ease of debugging
|
||||
locs = [[(0,0)] for _ in range(KNOTS)] # 10 knots :)
|
||||
for dir, rep in commands:
|
||||
for _ in range(rep):
|
||||
move_knot(locs[0], dir_to_offset(dir)) # move head
|
||||
for i in range(1, KNOTS):
|
||||
offset = add_nd(locs[i-1][-1], negate_nd(locs[i][-1]))
|
||||
if norm_infk_nd(offset) <= 1:
|
||||
continue # no need to catch up
|
||||
move_knot(locs[i], (sign(e) for e in offset))
|
||||
return len(set(locs[-1]))
|
||||
|
||||
|
||||
|
||||
def main(lines: Iterable[str]):
|
||||
splited = (line.strip().split() for line in lines)
|
||||
# -> [" D 4 ",...] -> [["D", "4"], ...]
|
||||
## Filters out any line that has empty newline and turn repitions into int
|
||||
commands = [(comp[0], int(comp[1])) for comp in splited if len(comp) > 0]
|
||||
# -> [[], ["D", "4"], ...] -> [["D", 4]]
|
||||
print("part1", part1(commands))
|
||||
print("part2", part2(commands))
|
||||
pass
|
||||
|
||||
if __name__=="__main__":
|
||||
with open(sys.argv[1], "r") as f:
|
||||
main(f)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
fn main() {
|
||||
// let test = include_str!("../data/example.txt");
|
||||
let sub = inlcude_str!("../data/submission.txt");
|
||||
let commands = sub.lines()
|
||||
.map(|line| line.split(" "))
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
if command -v nix-shell &> /dev/null
|
||||
then
|
||||
use flake
|
||||
fi
|
|
@ -1,2 +0,0 @@
|
|||
.direnv
|
||||
target
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "d9"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1 +0,0 @@
|
|||
# Bootstrapping clojure project on
|
|
@ -1,7 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
|
@ -1,8 +0,0 @@
|
|||
[package]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -1,3 +0,0 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
Sensor at x=2, y=18: closest beacon is at x=-2, y=15
|
||||
Sensor at x=9, y=16: closest beacon is at x=10, y=16
|
||||
Sensor at x=13, y=2: closest beacon is at x=15, y=3
|
||||
Sensor at x=12, y=14: closest beacon is at x=10, y=16
|
||||
Sensor at x=10, y=20: closest beacon is at x=10, y=16
|
||||
Sensor at x=14, y=17: closest beacon is at x=10, y=16
|
||||
Sensor at x=8, y=7: closest beacon is at x=2, y=10
|
||||
Sensor at x=2, y=0: closest beacon is at x=2, y=10
|
||||
Sensor at x=0, y=11: closest beacon is at x=2, y=10
|
||||
Sensor at x=20, y=14: closest beacon is at x=25, y=17
|
||||
Sensor at x=17, y=20: closest beacon is at x=21, y=22
|
||||
Sensor at x=16, y=7: closest beacon is at x=15, y=3
|
||||
Sensor at x=14, y=3: closest beacon is at x=15, y=3
|
||||
Sensor at x=20, y=1: closest beacon is at x=15, y=3
|
|
@ -1,34 +0,0 @@
|
|||
Sensor at x=3842919, y=126080: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=406527, y=2094318: closest beacon is at x=-1066, y=1333278
|
||||
Sensor at x=2208821, y=3683408: closest beacon is at x=2914373, y=3062268
|
||||
Sensor at x=39441, y=1251806: closest beacon is at x=-1066, y=1333278
|
||||
Sensor at x=3093352, y=2404566: closest beacon is at x=2810772, y=2699609
|
||||
Sensor at x=3645473, y=2234498: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=3645012, y=2995540: closest beacon is at x=4001806, y=2787325
|
||||
Sensor at x=18039, y=3083937: closest beacon is at x=103421, y=3007511
|
||||
Sensor at x=2375680, y=551123: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=776553, y=123250: closest beacon is at x=-1066, y=1333278
|
||||
Sensor at x=2884996, y=2022644: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=1886537, y=2659379: closest beacon is at x=2810772, y=2699609
|
||||
Sensor at x=3980015, y=3987237: closest beacon is at x=3844688, y=3570059
|
||||
Sensor at x=3426483, y=3353349: closest beacon is at x=3844688, y=3570059
|
||||
Sensor at x=999596, y=1165648: closest beacon is at x=-1066, y=1333278
|
||||
Sensor at x=2518209, y=2287271: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=3982110, y=3262128: closest beacon is at x=3844688, y=3570059
|
||||
Sensor at x=3412896, y=3999288: closest beacon is at x=3844688, y=3570059
|
||||
Sensor at x=2716180, y=2798731: closest beacon is at x=2810772, y=2699609
|
||||
Sensor at x=3575486, y=1273265: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=7606, y=2926795: closest beacon is at x=103421, y=3007511
|
||||
Sensor at x=2719370, y=2062251: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=1603268, y=1771299: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=3999678, y=1864727: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=3157947, y=2833781: closest beacon is at x=2914373, y=3062268
|
||||
Sensor at x=3904662, y=2601010: closest beacon is at x=4001806, y=2787325
|
||||
Sensor at x=3846359, y=1608423: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=2831842, y=3562642: closest beacon is at x=2914373, y=3062268
|
||||
Sensor at x=3157592, y=1874755: closest beacon is at x=2761373, y=2000000
|
||||
Sensor at x=934300, y=2824967: closest beacon is at x=103421, y=3007511
|
||||
Sensor at x=3986911, y=1907590: closest beacon is at x=3943893, y=1918172
|
||||
Sensor at x=200888, y=3579976: closest beacon is at x=103421, y=3007511
|
||||
Sensor at x=967209, y=3837958: closest beacon is at x=103421, y=3007511
|
||||
Sensor at x=3998480, y=1972726: closest beacon is at x=3943893, y=1918172
|
|
@ -1,94 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670064435,
|
||||
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1665296151,
|
||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670552927,
|
||||
"narHash": "sha256-lCE51eAGrAFS4k9W5aDGFpVtOAwQQ/rFMN80PCDh0vo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0fdafd18c9cf599fde17fbaf07dbb20fa57eecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{
|
||||
description = "D4 AOC with Lua!";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... } @ inputs:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
||||
let
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
pkgs = import nixpkgs { system = sys; overlays = overlays; };
|
||||
shellHookAfter = ''
|
||||
echo "The input files should be placed under ./data/{submission,example}.txt"
|
||||
echo "This problem shares one input between two parts"
|
||||
'';
|
||||
py_pkgs = [ pkgs.python310 ];
|
||||
rs_pkgs = [
|
||||
pkgs.openssl
|
||||
pkgs.pkg-config
|
||||
|
||||
# Add rust-src, which rust-analyzer seems to rely upon
|
||||
(pkgs.rust-bin.selectLatestNightlyWith
|
||||
(
|
||||
toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
}
|
||||
))
|
||||
# rust devex
|
||||
pkgs.bacon # kinda like nodemon
|
||||
pkgs.rust-analyzer
|
||||
];
|
||||
in
|
||||
{
|
||||
# Jack of all trades
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
buildInputs = py_pkgs ++ rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Default runtime. This contains both rust and python3 env"
|
||||
echo "Run ./run-py.sh for Python's output and ./run-rs.sh for Rust's output"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
devShells = {
|
||||
# nix develop ./#lua
|
||||
# lua = pkgs.mkShell {
|
||||
# nativeBuildInputs = lua_pkgs;
|
||||
# shellHook = ''
|
||||
# echo "> Lua runtime"
|
||||
# echo "Run ./run-lua.sh to see the output of the solution"
|
||||
# '' + shellHookAfter;
|
||||
# };
|
||||
|
||||
# nix develop ./#fennel
|
||||
|
||||
# nix develop ./#python
|
||||
rust = pkgs.mkShell {
|
||||
nativeBuildInputs = rs_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Rust runtime"
|
||||
echo "Run ./run-rs.sh to see output of the solution"
|
||||
echo "For quick feedback loop: bacon check-all"
|
||||
'' + shellHookAfter;
|
||||
};
|
||||
python = pkgs.mkShell {
|
||||
nativeBuildInputs = py_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Python3 runtime"
|
||||
echo "Run ./run-py.sh to see the output of the solution"
|
||||
'' + shellHookAfter;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
echo "example"
|
||||
python3 ./src/main.py ./data/example.txt
|
||||
|
||||
echo "submission"
|
||||
python3 ./src/main.py ./data/submission.txt
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from typing import Iterable, Optional
|
||||
from dataclasses import dataclass
|
||||
import os
|
||||
import string
|
||||
from functools import reduce
|
||||
|
||||
@dataclass
|
||||
class RectBound:
|
||||
bot_left: tuple[int, int]
|
||||
top_right: tuple[int, int]
|
||||
|
||||
@dataclass
|
||||
class Sensor:
|
||||
loc: tuple[int, int]
|
||||
radius_1k: int
|
||||
nearest_beacon: tuple[int, int]
|
||||
_rect_bound: Optional[RectBound] = None # inclusive
|
||||
|
||||
def rect_bound(self):
|
||||
if not self._rect_bound:
|
||||
self._rect_bound = RectBound(\
|
||||
(self.loc[0]-self.radius_1k, self.loc[1]-self.radius_1k),
|
||||
(self.loc[0]+self.radius_1k, self.loc[1]+self.radius_1k),
|
||||
)
|
||||
return self._rect_bound
|
||||
|
||||
def vec2d_str(x: str, y: str):
|
||||
return (int(x), int(y))
|
||||
|
||||
def vec_diff(lhs: Iterable[int], rhs: Iterable[int]):
|
||||
return tuple(l - r for l, r in zip(lhs, rhs))
|
||||
|
||||
def norm_1k(vec: Iterable[int]):
|
||||
return sum(abs(e) for e in vec)
|
||||
|
||||
@dataclass
|
||||
class SolutionBound:
|
||||
min_x: int
|
||||
min_y: int
|
||||
max_x: int
|
||||
max_y: int
|
||||
|
||||
def solution_bound(sensors: list[Sensor]):
|
||||
return SolutionBound(min(sensor.loc[0] - sensor.radius_1k for sensor in sensors),
|
||||
min(sensor.loc[1] - sensor.radius_1k for sensor in sensors),
|
||||
max(sensor.loc[0] + sensor.radius_1k for sensor in sensors),
|
||||
max(sensor.loc[1] + sensor.radius_1k for sensor in sensors),
|
||||
)
|
||||
|
||||
def which_sensor(loc: tuple[int, int], sensors: list[Sensor]):
|
||||
"""
|
||||
Arbitrary sensor number, not nearest or anything.
|
||||
Actually, this fancies the lower index
|
||||
"""
|
||||
for i, sensor in enumerate(sensors):
|
||||
if norm_1k(vec_diff(sensor.loc, loc)) <= sensor.radius_1k:
|
||||
return (i, sensor if sensor.loc == loc else None)
|
||||
return None
|
||||
|
||||
def beacons_set(sensors: list[Sensor]):
|
||||
return set(sensor.nearest_beacon for sensor in sensors)
|
||||
|
||||
def gen_graph(sensors: list[Sensor], sol_bound: Optional[SolutionBound] = None):
|
||||
sol_bound = sol_bound if sol_bound is not None else solution_bound(sensors)
|
||||
beacons = beacons_set(sensors)
|
||||
return [[which_sensor((x, y), sensors) if (x, y) not in beacons else 'B'
|
||||
for x in range(sol_bound.min_x, sol_bound.max_x + 1)]
|
||||
for y in range(sol_bound.min_y, sol_bound.max_y + 1)]
|
||||
|
||||
def render_graph(graph: list[list[None | tuple[int, Optional[Sensor]] | str]]):
|
||||
def sensor_display(x: None | tuple[int, Optional[Sensor]] | str):
|
||||
match x:
|
||||
case (int(v), s):
|
||||
sensor = ("0123456789"+string.ascii_lowercase)
|
||||
signal = (")!@#$%^&*("+string.ascii_uppercase)
|
||||
return (signal if s is not None else sensor)[v]
|
||||
case None:
|
||||
return '.'
|
||||
case str(s):
|
||||
return s
|
||||
case e:
|
||||
raise RuntimeError(f"Unexpected {e}")
|
||||
|
||||
return list(" ".join(sensor_display(e) if e else '.' for e in row) for row in graph)
|
||||
|
||||
def sensor_range_at(sensor: Sensor, y: int):
|
||||
effective_radius = max(sensor.radius_1k - abs(y - sensor.loc[1]), 0)
|
||||
if effective_radius == 0 and sensor.loc[1] != y:
|
||||
return iter([])
|
||||
return range(sensor.loc[0] - effective_radius, sensor.loc[0] + effective_radius + 1)
|
||||
|
||||
def index_render_graph(rendered_graph: list[str], sol: SolutionBound):
|
||||
return os.linesep.join(f"{str(i + sol.min_y).zfill(3)} {row}"
|
||||
for i, row in enumerate(rendered_graph))
|
||||
|
||||
def part1(sensors: list[Sensor], y:int):
|
||||
sol = solution_bound(sensors)
|
||||
print(sol)
|
||||
# rendered_graph = render_graph(gen_graph(sensors, sol))
|
||||
# print(index_render_graph(rendered_graph, sol))
|
||||
beacons = beacons_set(sensors)
|
||||
ranges = list(set(sensor_range_at(sensor, y))
|
||||
for sensor in sensors)
|
||||
print("ranges", ranges)
|
||||
x_sense = reduce(lambda lhs, rhs: lhs.union(rhs), ranges).difference({beacon[0] for beacon in beacons if beacon[1] == y})
|
||||
# return sum((x, y) not in beacons and which_sensor((x, y), sensors) is not None
|
||||
# for x in range(sol.min_x, sol.max_x + 1))
|
||||
print("x_sense", x_sense)
|
||||
return len(x_sense)
|
||||
|
||||
def part2(sensors: list[Sensor], y:int):
|
||||
pass
|
||||
|
||||
|
||||
def sensor_from_input_line(line: str):
|
||||
# print(line)
|
||||
spl = line.split("=")
|
||||
# print(spl)
|
||||
_, sensor_x, sensor_y, beacon_x, beacon_y =spl
|
||||
digit_only = lambda x: "".join(filter(lambda v: isinstance(v, str) and v in "0123456789-", x))
|
||||
sensor_loc = vec2d_str(digit_only(sensor_x), digit_only(sensor_y))
|
||||
beacon_loc = vec2d_str(digit_only(beacon_x), beacon_y)
|
||||
return Sensor(sensor_loc, norm_1k(vec_diff(beacon_loc, sensor_loc)), beacon_loc)
|
||||
|
||||
def main(lines: Iterable[str]):
|
||||
sensors = list(sensor_from_input_line(stripped_line)
|
||||
for stripped_line in (line.strip() for line in lines) if len(stripped_line) > 0)
|
||||
beacons = beacons_set(sensors)
|
||||
print(os.linesep.join(repr(sensor) for sensor in sensors))
|
||||
print("beacons:", beacons)
|
||||
y1, y2 = 10, 2000000
|
||||
print("part1", part1(sensors, y1), part1(sensors, y2))
|
||||
# print("part2", part2(sensors, y1), part2(sensors, y2))
|
||||
pass
|
||||
|
||||
|
||||
def _main(filename: str):
|
||||
with open(filename, "r") as f:
|
||||
main(f)
|
||||
|
||||
if __name__=="__main__":
|
||||
_main(sys.argv[1])
|
||||
|
||||
# For neovim integrated repl which can evaluate per selection
|
||||
REPL = """
|
||||
_main("./data/example.txt")
|
||||
_main("./data/submission.txt")
|
||||
|
||||
"""
|
|
@ -1,6 +0,0 @@
|
|||
fn main() {
|
||||
// let test = include_str!("../data/example.txt");
|
||||
let sub = inlcude_str!("../data/submission.txt");
|
||||
let commands = sub.lines()
|
||||
.map(|line| line.split(" "))
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
# Bootstrapping clojure project on
|
|
@ -1 +0,0 @@
|
|||
mjqjpqmgbljsphdztnvjfqwrcgsmlb
|
|
@ -1,3 +0,0 @@
|
|||
hrbbjllllspssblslvvrdrbbpbbmcccfppvbbwvbbmrmjrjrfrgfgbffgfqfqlltlwttscsncscchssrppffvwwvvpnnwwwpvwvhhnvhhbttvzzdlzdlzzwmmjhhznnjdnnnqddbtdbdbsdsmdsdrrdpdwpdppgcgqgcctftsfszslljbljbjwbwbnwnqqrnnztntmtrmmzwzdwzwgwwwjhjsjgjtjjhpjhhppqzqdqffrvrtvvsmmgwmgwgbbclltctptzpzhpzptzppcfpcfftflfzftztddzgzmmfsmsrmmsstttvbvmbvvsmsqmqlldjdtthwtwbwggrzzjrzrcctffsshqshhpthhlnhlhqhdqqrwrmmcttpfttzfzgzdgdzzwrrtsrrsnrnccrbbsssbpbjjvzzwlwtwjwsjwjggzqgzzrsszzjnzjzwjzzcrzczncnqqztzfzhfhvvtjvjdvjjmrjrppvzppczpczcggshghvhnhhsrsnsdszzdpzpzlpzzhwwmnwmwmcwwfnwfwjjcbcncllcsllqdqzzhqhmqmbbjvjjwwcjjpnpllzfzddtmtccqrcrtrwrpphpmpplslmltthnnvhhvrvbblhhrrdqqmbqqgtqggdgcdcvvsbsswvvpggbbtftlflglzlmlbbfhhrshswhshffhhdnnrfrvrmrnrprrmfmpmnpnfnggvvcncdcrczrzccpmmssrbbdjdtdrdwrrwhrrvrtvvszvvwvzzmhhjhhwlhlqlvlttzftztdtstftrfrdddmtmzzsqzqvvpdpdcpcncnrrtntznzrzgznztnznhhsqqnrqrhhlzhzthhfddrzdrrqmqggcmmllnjjvwwjccfjfqfcfzccwvcwvcvjcjtjtnnqsqmqrmrzrszrszzfwfggnmmcdmdjmmhwwgfwfnwnlwwcffsrffvnvbvnvwnwgnwnmmbzbmbpplmplpspzpmzpzdzgzrzrtrjrbbppwvwgwmggqwgghqqshhcwcqwcqcfcbbnsnrrtztzrtrvtvhthzhmmrqqrwqqsjqjcctgtwthhqmmnffmgmdgdlgljjhwjwggrqqfrqqjvqvhqqgsqsgsttmrrbprbppmjppslpsllvlfvlvrvhvtqmrjcdzwsbzfmgmwmwqwhztqrsdzhqjqvbjbntnbndflthljcczdmmhszfgsplrtlqnfzbrlqngwdqtfwcmrdjrsmdpmjmqwrbwfjzwnvqhfmlqtvvnlfzbfccwslqpbzzjccbvrzhghqwtvqgwrmsfzqnmnqqjsjtpcmngpqgllfsnpqtjjbqcdppnsmtwrslnrbqtwvnbctzvwfmgctscmzjbqqgqdwbpzmrdwgfcjzftzgmfcjhchbnmnqnrgtqngwrmncjvptqqdtjtgtpzzdrfsdgmwlwrjnqldbwrqjrhwcczlzvlhpgrnwzhbwjnpthggczfgtrjnzvnlfdfbwcnzfbwlwlmgnnjnpvhbhqgnzhqsnmvbcftsmrcgpvnnnmgnrvpbzlpwnbwpzmwpgqvbfgjwfrjqnvvgmqwwcfddqmdznmfhpjcfgptqdqwmplrglbwlmsqzjshrlhflcjvptgrcfhjfgqmlfzrtphpbvcqzwpcnwljjdlmqzhcctqshdngrgtlfsrfccdtlvmqcdgnpcvphdsrpzfzwclvsqcpzqlfvvqzggdhpfzdvhshglvfzfmcllrdfjfsjtngjgddcpqnlmrnplwtlvwdvzftltnsnspcdztgqhlhvvbnwvnmhscfnqbngpvprzfrjcmfpfzfftrlnwgllhnjndpjdrwcgqpcgcqngnbfzlvzvhnqdjthflmwvppmbdssddmgsbgrqnpjzrjpzdddqgsdlmwnhhpjbthclvqhgrsnrbqgtnsjhncnzbhrdgftvbptrqssvsqfpqnddhmgwcrfqndqjsqgffmhdvqhjrdlmrlcqctqccprwlbqgqrwmtfhwmfjfqzdqbsdsjbtsvfvgbsrvqwnqqqqthpsqgcfslsqtnjwtsrcdcctggdghrjwpbfccrtwgszwbrsjswmjmjbcqrsgbcfsdjzsbjnnssnddnnvwgftlrqvphnqcgjszscrlhhjnljlqcjqtqfwbmdmrgdlcqqwmbsmsdhpplvlfglqwspbfptlbzqjwhqmfvzvsvpjclcdzsbvntmhdqdvhghcmmflpjbglsghbswdshtsbdrgpsrsclrmfwwqbrgdjsqztgttqpwhnfhszlgbfpzhczsnwqflmshlgbrpmdzgpqwtsbssgfjbtrwbmztlwwfmsdgpgfgdjfdccwlfgztbcbqjvjtvslmddjplrswwcszspgplsrhrnwnmrrfbcgdmntcrlvnfqtwwcczsglrhtrfqnmhvgzjpmlplqvqhmnfgvzqcmzhqszgslvndqtqhvrbvbmclbcbjdswvcjrzgfdmdwnnlzlzqcffsrqdfmmpzfnmdsnqlpcrhzsdnsflblcjsfsgcnsspftjrlmdjsmfpqtmlgfvnlfnjscsgwzwvpjrvvclhsbqldlnmtglhbjfwlzmvrbvgtprfjbjhhnlqnbrswwlqtcgrjrltdrnfrjhrntllptlsbhqrwvdsfrlghtfcndznzjwcgmtdvffltgrdmljlqhdtmdvnfsfsrvdpmhlrrsttvqlwfptddwbpfrbclwwzmfpttmrmmqzjnbbnnfvzwmmcfshvrlbdbjzprftbqvdsghnnzwbjccpthdsvsdlgvphsgjdqjwsgmzqnqpqvgqjvwgjtzpmqqwnlwrwhqqjjclcbhjgpwhqdclwmqfmwbwmwwvcbhfznfhcfbprfcdqlbcttnvgnjwswcmpbrghtzgdbppbprffzjgvddzpwmdctrhnrfzdfhtmnfrsfdqvzcnrtncflhvldcndwqtvbggmwlzhchlcwtcbqcvlfhdwljgddwpvcfczvfqmphgtdsnsqwdpvvmwnwqjbrjwbdhhgtffphsdrvspsbgmfrmwmhnrgqdfppzgfpgmqjcsnglczgwhjthfhztzrlpgzjhcfrjpjvtjptptbvflftjtcfhmbwlhlbhvnjnbfmwjrgbvvhmdlncdgncgfjcnnpdljfcjsmsfscqpwsgcmlhhqmldsnjfrrqpghwncmgwgnjsdtvbhrbbnmpqjrrctqqnqzztmbqmdsgdvmmlwmbvprllzgntnmttrlzrttmjjlrwpwmtfznmwnsjmjhjdnsppfhcrjpzhjqzdtdbsjshfzzvrwvjbjbgtsfpgggbdztczwlhpmthfjdgsbrvlwmlrvgdrpjzccwmgpcnqqzmqdjqmwsrzwsmtmdjdhmjrwfwnzlmfnqtcgtslwtlnwhvmqntmglhntnsjlnmzfvfdztcfwmpchsrsdmqvqcwljzrmmssjvbmvvnmqlbsdwnrbmqctdtmfzlgfzpmjcnftgftvjpfbwwmzfdrrwjwcfwfcfmzbbnppgjrmbcvmvnjpdrzmvndvddtvshlnjjwgtsvnwtwnhcbfpnthpjlrhgrqccdgppjvdqjwqrfrrgnvhfwvjhnwhntnpmghphrtgqhwtbrqhqljfdjbgnlgmqqgfcqpqfhcpgspdbvlbfjvlrgmtjztwdzlrhqwwtcpdvsqgssjbjjgqlwbcctzzqvvmdzpfrmspmqhtzwgcfsslpnhpjfwqrrfbwbndrvhnnsjnlvlvqdsgwzjsrprhgtvsfbhbcpljdczbtdwzcnhzntrwcrjctmhtjfdlthznzmqblppzcqgpjhlzjrmcvpptfjjzltdhmvwphwlccscwrwfcqpqwwrzcmnltzdcfvtjrcvsqwtchrmdfzjmzjfhppjzbhglwqggzqqnspfmzrfwrqdqdrsdbsdhcgdqrrnjlwrqhfhpzjhrvjndqphndnnnbwhrjvqrrbvlhhbljjcwmfpvnhcszfshlsnczgtcfhjslbhzczdqdmdnvqdzhbmbpcnbntwgllfscrcwhfrgtfvftmwhbgfhjzjrbvvwc
|
||||
|
||||
|
|
@ -3,12 +3,8 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
clj-nix = {
|
||||
url = "github:jlesquembre/clj-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { nixpkgs, flake-utils, clj-nix, ... } @ inputs:
|
||||
outputs = { nixpkgs, flake-utils, ... } @ inputs:
|
||||
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
||||
let
|
||||
overlays = [ ];
|
||||
|
@ -17,15 +13,13 @@
|
|||
echo "The input files should be placed under ./data/{submission,example}.txt"
|
||||
echo "This problem shares one input between two parts"
|
||||
'';
|
||||
clj_pkgs = import clj-nix { system = sys; };
|
||||
py_pkgs = [ pkgs.python310 ];
|
||||
clojure_pkgs = [ ];
|
||||
|
||||
# lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ];
|
||||
fennel_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.fennel luapkgs.readline ])) ];
|
||||
in
|
||||
{
|
||||
# Jack of all trades
|
||||
devShell = pkgs.mkShell
|
||||
{
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = py_pkgs ++ fennel_pkgs;
|
||||
shellHook = ''
|
||||
echo "> Default runtime. This contains both fennel and python3 env"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# dune init project aoc_37_ocaml
|
||||
# OCAMLPARAM: unset
|
|
@ -1,4 +0,0 @@
|
|||
(executable
|
||||
(public_name aoc_37_ocaml)
|
||||
(name main)
|
||||
(libraries aoc_37_ocaml))
|
|
@ -1 +0,0 @@
|
|||
let () = print_endline "Hello, World!"
|
|
@ -1,2 +0,0 @@
|
|||
(library
|
||||
(name aoc_37_ocaml))
|
|
@ -1,2 +0,0 @@
|
|||
(test
|
||||
(name aoc_37_ocaml))
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
from typing import Iterable
|
||||
|
||||
|
||||
def main(lines: Iterable[str]):
|
||||
ROOT_WD = [""]
|
||||
ROOT="/".join(ROOT_WD)
|
||||
|
@ -38,3 +39,5 @@ if __name__ == "__main__":
|
|||
import sys
|
||||
with open(sys.argv[1], "r") as f:
|
||||
main(f)
|
||||
|
||||
"/".join([""])
|
||||
|
|
Loading…
Reference in New Issue