Skip to content

Instantly share code, notes, and snippets.

View bluepichu's full-sized avatar

Matthew Savage bluepichu

View GitHub Profile
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) {
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;
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);
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 = ["(", "[", "{", "<"];
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;
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");
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
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) => {
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++) {
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;