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
{ | |
const input = document.body.innerText | |
function parseMap() { | |
const rowsUnparsed = input.split("\n") | |
const rows = [] | |
for (let y = 0; y < rowsUnparsed.length; y++) { | |
rows[y] = rowsUnparsed[y].split("") | |
} |
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
{ | |
const input = document.body.innerText.trim() | |
const cardsRaw = input.split("\n") | |
// Parse | |
/** @typedef {{idx: number, winning : number[], scratched : number[]}} Card */ | |
/** @type {Card[]} */ | |
const cards = [] | |
for (let i = 0; i < cardsRaw.length; 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
const { readFileSync } = require("fs") | |
// const input = readFileSync("example.txt").toString() | |
const input = readFileSync("input.txt").toString() | |
const lines = input.split("\n").map(l => l.trim()) | |
const seeds = lines.find(t => t.includes("seeds:")) | |
.split(":")[1] | |
.split(" ") | |
.map(t => t.trim()) |