From 8fa52e5b797c0c569b970e1fb9dedced163bb3a7 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 4 Dec 2024 15:36:46 +0000 Subject: [PATCH] 2024 day 4 part 1 --- 2024/04/example.txt | 10 +++ 2024/04/flake.lock | 59 ++++++++++++++++ 2024/04/flake.nix | 31 +++++++++ 2024/04/input.txt | 140 ++++++++++++++++++++++++++++++++++++++ 2024/04/solution.nix | 72 ++++++++++++++++++++ 2024/04/solution.test.nix | 80 ++++++++++++++++++++++ 6 files changed, 392 insertions(+) create mode 100644 2024/04/example.txt create mode 100644 2024/04/flake.lock create mode 100644 2024/04/flake.nix create mode 100644 2024/04/input.txt create mode 100644 2024/04/solution.nix create mode 100644 2024/04/solution.test.nix diff --git a/2024/04/example.txt b/2024/04/example.txt new file mode 100644 index 0000000..1f4eda2 --- /dev/null +++ b/2024/04/example.txt @@ -0,0 +1,10 @@ +MMMSXXMASM +MSAMXMSMSA +AMXSXMAAMM +MSAMASMSMX +XMASAMXAMM +XXAMMXXAMA +SMSMSASXSS +SAXAMASAAA +MAMMMXMMMM +MXMXAXMASX diff --git a/2024/04/flake.lock b/2024/04/flake.lock new file mode 100644 index 0000000..dc94ab4 --- /dev/null +++ b/2024/04/flake.lock @@ -0,0 +1,59 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1732837521, + "narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1703013332, + "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", + "path": "/nix/store/50bgi74d890mpkp90w1jwc5g0dw4dccr-source", + "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "tix": "tix" + } + }, + "tix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1704309534, + "narHash": "sha256-U9qeMl0WBlpy335gL06WFGvPxLBTd+ToiiCHUHWrgR0=", + "ref": "refs/heads/master", + "rev": "5007770e88c4d5f67c3790761a1125904a9ef257", + "revCount": 20, + "type": "git", + "url": "https://git.tristans.cloud/tristan/tix" + }, + "original": { + "type": "git", + "url": "https://git.tristans.cloud/tristan/tix" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/2024/04/flake.nix b/2024/04/flake.nix new file mode 100644 index 0000000..0f8e588 --- /dev/null +++ b/2024/04/flake.nix @@ -0,0 +1,31 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + tix.url = "git+https://git.tristans.cloud/tristan/tix"; + }; + + outputs = { self, nixpkgs, tix }: let + pkgs = import nixpkgs {system = "x86_64-linux";}; + solution = import ./solution.nix pkgs; + in { + + part1example = (solution (pkgs.lib.readFile ./example.txt)).part1result; + part1 = (solution (pkgs.lib.readFile ./input.txt)).part1result; + + part2example = (solution {file = ./example.txt;}).part2result; + part2 = (solution {file = ./input.txt;}).part2result; + + packages.x86_64-linux.watch = tix.watch { + cmd = '' + nix run .\#test --impure --extra-experimental-features pipe-operators + ''; + }; + + packages.x86_64-linux.test = tix.run [ + ./solution.test.nix + ]; + + }; +} diff --git a/2024/04/input.txt b/2024/04/input.txt new file mode 100644 index 0000000..879c99e --- /dev/null +++ b/2024/04/input.txt @@ -0,0 +1,140 @@ +XMXXXMMXXSXMSMMMSXMSSSMASXMAXSMMMAASAMXASASXSXSASMSMSSSXSMASXMMSAMMMSAMXSMMMAMMSMMSXSAMXMSMSASMSMSMSSSMMSMMMMMASMSSMSSXMAMXMASAMAMXSXSXMMASA +MXMMMM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AMASMMMAAASASAAXXMASAAAAAMSMXMAAAAASMMAAAAMMSAMXXAAAXMMMSAMXSMMMMSAMXXMASM +MXMXMMSMSSSMSSMXSMMMMSXMASMSXXAMSMMMMMMMMMSMXSSXSXXSASXXMXMMSMMMSSSMXSXXMSMMMSMMMMXSAMMSSMXXXXMASMSMMMMASMMSSXMXMASMMMSXMASASXMXMASXXSAAMMMX diff --git a/2024/04/solution.nix b/2024/04/solution.nix new file mode 100644 index 0000000..9aba538 --- /dev/null +++ b/2024/04/solution.nix @@ -0,0 +1,72 @@ +{lib, ...}: input: rec { + + content = lib.trim input; + + emptyLines = lines: lines + |> builtins.length + |> genStrList "" + ; + + genStrList = str: builtins.genList (_: str); + + rotated = input: input + |> lib.strings.splitString "\n" + |> map (lib.stringToCharacters) + |> (lines: builtins.foldl' + (lib.zipListsWith (a: b: a + b)) + (emptyLines lines) + lines) + |> lib.concatStringsSep "\n" + ; + + len = builtins.length (lib.strings.splitString "\n" content); + + diagonal = input: input + |> lib.strings.splitString "\n" + |> map (lib.stringToCharacters) + |> (lines: builtins.foldl' + ({acc, i}: line: { + acc = lib.zipListsWith (a: b: a + b) acc + ((genStrList " " i) ++ line ++ (genStrList " " (len - i))); + i = i + 1; + }) + { + acc = (emptyLines lines) ++ emptyLines (builtins.elemAt lines 0); + i = 0; + } + lines) + |> ({acc, ...}: acc) + |> map lib.trim + |> lib.concatStringsSep "\n" + ; + + reversed = input: input + |> lib.strings.splitString "\n" + |> map reverseString + |> lib.concatStringsSep "\n" + ; + + reverseString = s: s + |> lib.stringToCharacters + |> lib.reverseList + |> lib.concatStringsSep "" + ; + + search = term: input: input + |> builtins.split term + |> builtins.filter lib.isList + |> builtins.length + ; + + searchForwardAndBack = term: input: + search term input + + search (reverseString term) input; + + findXMAS = searchForwardAndBack "XMAS"; + + part1result = findXMAS content + + findXMAS (diagonal content) + + findXMAS (rotated content) + + findXMAS (diagonal (reversed content)) + ; +} diff --git a/2024/04/solution.test.nix b/2024/04/solution.test.nix new file mode 100644 index 0000000..8e03679 --- /dev/null +++ b/2024/04/solution.test.nix @@ -0,0 +1,80 @@ +{describe, it, ...}: +let + pkgs = import {}; + solution = import ./solution.nix pkgs; + content = '' + MMMSXXMASM + MSAMXMSMSA + AMXSXMAAMM + MSAMASMSMX + XMASAMXAMM + XXAMMXXAMA + SMSMSASXSS + SAXAMASAAA + MAMMMXMMMM + MXMXAXMASX''; + rotated = '' + MMAMXXSSMM + MSMSMXMAAX + MAXAAASXMM + SMSMSMMAMX + XXXAAMSMMA + XMMSMXAAXX + MSAMXXSSMM + AMASAAXAMA + SSMMMMSAMS + MAMXMASAMX''; + diagonal = '' + M + MM + MSA + SAMM + XMXSX + XXSAMX + MMXMAXS + ASMASAMS + SMASAMSAM + MSAMMMMXAM + AMSXXSAMX + MMAXAMMM + XMASAMX + MMXSXA + ASAMX + SAMM + AMA + MS + X + ''; + example = solution content; +in [ + (describe "part 1" [ + (it "gets content forward" { + actual = example.forward; + expected = content; + }) + (it "gets content rotated" { + actual = example.rotated content; + expected = rotated; + }) + (it "gets content diagonal" { + actual = example.diagonal content; + expected = diagonal; + }) + (it "reverses string" { + actual = example.reverseString "XMAS"; + expected = "SAMX"; + }) + (it "searches for term" { + actual = example.search "XMAS" content; + expected = 3; + }) + (it "searches for term in reverse" { + actual = example.searchForwardAndBack "XMAS" content; + expected = 5; + }) + (it "gets the result" { + actual = example.part1result; + expected = 18; + }) + ]) +]