d5-py: bonehead on data copy-paste
parent
67130ccc37
commit
c0912bcc1e
|
@ -15,6 +15,7 @@
|
||||||
'';
|
'';
|
||||||
py_pkgs = [ pkgs.python310 ];
|
py_pkgs = [ pkgs.python310 ];
|
||||||
lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ];
|
lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ];
|
||||||
|
fennel_pkgs = [];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Jack of all trades
|
# Jack of all trades
|
||||||
|
|
|
@ -17,6 +17,7 @@ class MoveInsn:
|
||||||
def part1(crates: list[list[str]], insns: list[MoveInsn]) -> str:
|
def part1(crates: list[list[str]], insns: list[MoveInsn]) -> str:
|
||||||
for move in insns:
|
for move in insns:
|
||||||
for _ in range(move.how_many):
|
for _ in range(move.how_many):
|
||||||
|
# print(crates)
|
||||||
crates[move.to_crate - 1].append(crates[move.from_crate - 1].pop())
|
crates[move.to_crate - 1].append(crates[move.from_crate - 1].pop())
|
||||||
return "".join([crate[-1] for crate in crates])
|
return "".join([crate[-1] for crate in crates])
|
||||||
|
|
||||||
|
@ -75,3 +76,4 @@ if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
with open(sys.argv[1], "r") as f:
|
with open(sys.argv[1], "r") as f:
|
||||||
main(f)
|
main(f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue