This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List } from "immutable"; | |
import { Advent, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 6 }); | |
compute(async (input) => { | |
let count = Array.from(new Array(9), () => 0); | |
let init = input.tokens(/,/).map(int); | |
for (let v of init) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List, Set } from "immutable"; | |
import { Advent, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 8 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
// const data = input.ints(); | |
const data = input.lines(); | |
let ans = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { readFile, writeFile } from "fs/promises"; | |
import { join as pathJoin } from "path"; | |
import { List } from "immutable"; | |
import fetch from "node-fetch"; | |
import * as readline from "readline"; | |
const readlineInterface = readline.createInterface({ input: process.stdin, output: process.stdout }); | |
const session = (await readFile(pathJoin(process.env.HOME!, ".advent_cookie"))).toString().trim(); | |
export const int = (x: string): number => parseInt(x, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Advent } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 10 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
// const data = input.ints(); | |
const data = input.lines(); | |
const left = ["(", "[", "{", "<"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List } from "immutable"; | |
import { Advent, GridDirections, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 11 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
// const data = input.ints(); | |
let ans = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Map } from 'immutable'; | |
import { Advent, arr, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 14 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
// const data = input.ints(); | |
const [start, rules] = input.all().split("\n\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Advent, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 17 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
// const data = input.ints(); | |
const x1 = 32 | |
const x2 = 65 | |
const y1 = -225 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List, Map, Set } from "immutable"; | |
import { Advent, int } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 19 }); | |
type Scanner = [number, number, number][]; | |
let deltas: [number, number, number][] = [[0, 0, 0]]; | |
let tfs = Set<List<number>>(); | |
compute(async (input) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List, Map, Set } from "immutable"; | |
import { Advent, arr } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 20 }); | |
compute(async (input) => { | |
// const data = input.tokens(/,/).map(int); | |
const [alg, imageStr] = input.all().split("\n\n"); | |
let image = imageStr.split("\n").map((c) => c.split("")); | |
for (let i = 0; i < 50; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List, Map, Set } from "immutable"; | |
import { Advent, int, arr } from "advent"; | |
const { compute, computeCheck } = await Advent({ day: 22 }); | |
interface Cube { | |
x1: number; | |
y1: number; | |
z1: number; | |
x2: number; |