Search

Results include substring matches and semantically similar vals. Learn more
robsimmons avatar
aoc_2023_21_1
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
const DISTANCE = 6;
const dusa = new Dusa(`
# AOC Day 21
#builtin NAT_SUCC s
# Input to start and node facts
nbbaier avatar
aocDay1
@nbbaier
Advent of Code 2023 - Day 1 solutions
Script
// #folder:aoc2023
// @aoc2023
// @title Day 1 solutions
import getAocData from "https://esm.town/v/nbbaier/getAocData";
const data = await getAocData(1);
const input = (await data.text()).split("\n").slice(0, -1);
nbbaier avatar
aocDay3
@nbbaier
// @title Day 3 solutions
Script
// #folder:aoc2023
// @aoc2023
// @title Day 3 solutions
import getAocData from "https://esm.town/v/nbbaier/getAocData";
const data = await (await getAocData(3)).text();
const input = data.split("\n");
robsimmons avatar
aoc_2023_15_2
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
focal: line[label.length] === '-' ? null : parseInt(line.slice(label.length + 1)),
const dusa = new Dusa(`
# AOC Day 15, Part 2
#builtin INT_PLUS plus
#builtin INT_TIMES times
robsimmons avatar
aoc_2023_15_1
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => ({ length: line.length, ascii: line.split("").map((ch) => ch.charCodeAt(0)) }));
const dusa = new Dusa(`
# AOC Day 15, Part 1
#builtin INT_PLUS plus
#builtin INT_TIMES times
nbbaier avatar
getAocData
@nbbaier
Helper function to get Advent of Code data AOC_TOKEN is a session token
Script
## Helper function to get Advent of Code data
`AOC_TOKEN` is a session token
return await fetch(`https://adventofcode.com/${year}/day/${day}/input`, {
headers: {
"Cookie": Deno.env.get("AOC_TOKEN"),
saolsen avatar
example_rust_http_val
@saolsen
Built from https://gist.github.com/saolsen/294683088bae9a8f9a8cf93e2b392729 See https://gist.github.com/saolsen/d273bb1baba5e912e4dc2b187511affa for how to build a rust val. See https://www.val.town/v/saolsen/use_example_rust_http_val for how to use this.
Script
const bytes = base64.decodeBase64(
// base64 encoded wasm module
AQY2QwQAtAAAaIAAgARBfIgFFDQELIAEPCwALaQECfwJAAkACQAJAIAAtAAAOBQEBAQIDAAsgAEEEahAoCw8LIABBBGoQUQ8LIABBBGoiACgCCCICBEAgACgCACEB
let imports: any = {};
imports["__wbindgen_placeholder__"] = imports;
nbbaier avatar
aocDay2
@nbbaier
// @title Day 2 solutions
Script
// @aoc2023
// @title Day 2 solutions
import getAocData from "https://esm.town/v/nbbaier/getAocData";
const data = await getAocData(2);
const input = (await data.text()).split("\n").slice(0, -1);
nbbaier avatar
aocDay4
@nbbaier
// @title Day 4 solutions
Script
// @aoc2023
// @title Day 4 solutions
import _ from "npm:lodash-es";
import getAocData from "https://esm.town/v/nbbaier/getAocData";
const data = await (await getAocData(4)).text();
const input = data.split("\n").slice(0, -1);
karfau avatar
aoc15_05
@karfau
// expect(secondStar(""), "*1 sample 2").to.equal("?");
Script
const sum = (sum, current) => sum + current;
const firstStar = (input: string) => {
return input.split("\n").map(
(line, li) => {
if (/ab|cd|pq|xy/.test(line)) return 0;
const vowels = line.match(/[aeiou]/g)?.length;
if ((vowels ?? 0) < 3) return 0;
const double = line.split("").find((c, i) => c === line[i + 1]);
// double && debug(double, `${li} ${line} (${vowels})`);
return double ? 1 : 0;
robsimmons avatar
aoc_2023_10_1
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.trim().split(""));
const dusa = new Dusa(`
# AOC Day 10, Part 1
#builtin INT_PLUS plus
#builtin INT_MINUS minus
robsimmons avatar
aoc_2023_10_2
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.trim().split(""));
const dusa = new Dusa(`
# AOC Day 10, Part 2
#builtin INT_PLUS plus
#builtin INT_MINUS minus
robsimmons avatar
aoc_2023_11_practical
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.trim().split(""));
const PROGRAM = `
# AOC Day 11
#builtin NAT_SUCC s
#builtin INT_TIMES times
robsimmons avatar
aoc_2023_11_impractical
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
.map((line) => line.trim().split(""));
const PROGRAM = `
# AOC Day 11
#builtin NAT_SUCC s
#builtin INT_TIMES times
robsimmons avatar
aoc_2023_12_sat
@robsimmons
An interactive, runnable TypeScript val by robsimmons
Script
const INPUT = `
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1
.trim()
.split("\n");
const PROGRAM = `