Skip to content

Instantly share code, notes, and snippets.

View Yazir's full-sized avatar
😶‍🌫️

Piotr Koniecko Yazir

😶‍🌫️
View GitHub Profile
@Yazir
Yazir / .js
Created December 3, 2023 14:57
aoc 2023 - #3 part 1+2
{
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("")
}
@Yazir
Yazir / .js
Created December 4, 2023 14:30
aoc 2023 - #4 part 1+2
{
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++) {
@Yazir
Yazir / .js
Created December 6, 2023 17:25
aoc 2023 - d5
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())