From 608f8cf49b8ab2d345642687fa0ab83a063d1539 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 1 Dec 2021 08:43:02 -0600 Subject: [PATCH] Day 1 part 1 done --- .vim/coc-settings.json | 10 ++++++++++ 2021/.gitignore | 1 + 2021/1.ts | 11 +++++++++++ 2021/deps.ts | 1 + 4 files changed, 23 insertions(+) create mode 100644 .vim/coc-settings.json create mode 100644 2021/.gitignore create mode 100644 2021/1.ts create mode 100644 2021/deps.ts diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json new file mode 100644 index 0000000..a81fc3c --- /dev/null +++ b/.vim/coc-settings.json @@ -0,0 +1,10 @@ +{ + "deno.enable": true, + "deno.lint": true, + "deno.unstable": true, + "prettier.disableLanguages": [ + "typescript", + "javascript" + ], + "tsserver.enable": false +} \ No newline at end of file diff --git a/2021/.gitignore b/2021/.gitignore new file mode 100644 index 0000000..63ff173 --- /dev/null +++ b/2021/.gitignore @@ -0,0 +1 @@ +*.input diff --git a/2021/1.ts b/2021/1.ts new file mode 100644 index 0000000..b5e4b69 --- /dev/null +++ b/2021/1.ts @@ -0,0 +1,11 @@ +import { readLines } from "./deps.ts"; + +// Day 1 +let increases = 0; +let lastDepth = Number.MAX_VALUE; +for await (const depthString of readLines(await Deno.open("1.input"))) { + const depth = parseInt(depthString); + if (depth > lastDepth) increases++; + lastDepth = depth; +} +console.log("Number of depth increases:", increases); diff --git a/2021/deps.ts b/2021/deps.ts new file mode 100644 index 0000000..64ea606 --- /dev/null +++ b/2021/deps.ts @@ -0,0 +1 @@ +export { readLines } from "https://deno.land/std@0.116.0/io/mod.ts";