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";