d5-py: bonehead on data copy-paste

master
pegasust 2022-12-05 06:02:53 +00:00
parent 67130ccc37
commit c0912bcc1e
3 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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)