From c0912bcc1ec95f6746fd4c402403358cb9eb5d68 Mon Sep 17 00:00:00 2001 From: pegasust Date: Mon, 5 Dec 2022 06:02:53 +0000 Subject: [PATCH] d5-py: bonehead on data copy-paste --- 2022/d4/flake.nix | 1 + 2022/d5/data/example.txt | 2 +- 2022/d5/src/d5.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/2022/d4/flake.nix b/2022/d4/flake.nix index a9cdef2..dbaf51c 100644 --- a/2022/d4/flake.nix +++ b/2022/d4/flake.nix @@ -15,6 +15,7 @@ ''; py_pkgs = [ pkgs.python310 ]; lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ]; + fennel_pkgs = []; in { # Jack of all trades diff --git a/2022/d5/data/example.txt b/2022/d5/data/example.txt index 192954e..2f96163 100644 --- a/2022/d5/data/example.txt +++ b/2022/d5/data/example.txt @@ -1,4 +1,4 @@ -[D] + [D] [N] [C] [Z] [M] [P] 1 2 3 diff --git a/2022/d5/src/d5.py b/2022/d5/src/d5.py index 90f6df9..84644e7 100644 --- a/2022/d5/src/d5.py +++ b/2022/d5/src/d5.py @@ -17,6 +17,7 @@ class MoveInsn: def part1(crates: list[list[str]], insns: list[MoveInsn]) -> str: for move in insns: for _ in range(move.how_many): + # print(crates) crates[move.to_crate - 1].append(crates[move.from_crate - 1].pop()) return "".join([crate[-1] for crate in crates]) @@ -75,3 +76,4 @@ if __name__ == "__main__": import sys with open(sys.argv[1], "r") as f: main(f) +