diff --git a/day_12/example_1.txt b/day_12/example_1.txt new file mode 100644 index 0000000..cc5f968 --- /dev/null +++ b/day_12/example_1.txt @@ -0,0 +1,4 @@ +AAAA +BBCD +BBCC +EEEC \ No newline at end of file diff --git a/day_12/example_2.txt b/day_12/example_2.txt new file mode 100644 index 0000000..cc213c5 --- /dev/null +++ b/day_12/example_2.txt @@ -0,0 +1,5 @@ +OOOOO +OXOXO +OOOOO +OXOXO +OOOOO \ No newline at end of file diff --git a/day_12/example_3.txt b/day_12/example_3.txt new file mode 100644 index 0000000..0b328f1 --- /dev/null +++ b/day_12/example_3.txt @@ -0,0 +1,10 @@ +RRRRIICCFF +RRRRIICCCF +VVRRRCCFFF +VVRCCCJFFF +VVVVCJJCFE +VVIVCCJJEE +VVIIICJJEE +MIIIIIJJEE +MIIISIJEEE +MMMISSJEEE \ No newline at end of file diff --git a/day_12/example_4.txt b/day_12/example_4.txt new file mode 100644 index 0000000..26ada03 --- /dev/null +++ b/day_12/example_4.txt @@ -0,0 +1,5 @@ +EEEEE +EXXXX +EEEEE +EXXXX +EEEEE \ No newline at end of file diff --git a/day_12/example_5.txt b/day_12/example_5.txt new file mode 100644 index 0000000..c7541ac --- /dev/null +++ b/day_12/example_5.txt @@ -0,0 +1,6 @@ +AAAAAA +AAABBA +AAABBA +ABBAAA +ABBAAA +AAAAAA \ No newline at end of file diff --git a/day_12/input.txt b/day_12/input.txt new file mode 100644 index 0000000..532a598 --- /dev/null +++ b/day_12/input.txt @@ -0,0 +1,140 @@ +KKUUIIIIIIIIIIIIMMMMMMMMMVVVVVVVVVVVVVVVVNNNNNTTTTTTTTTTMMBMYYKKKKRPPPPXXXXXXXXXXXXXXFFFFFFFFFFFNNNNNNNNNNNNNNNNNNNTTTTTTTTJJJFFFFFFIFMJEEEE +KKUUIIIIIIIIIIIIIMMMMMMMMMVVVVVVVVVVVVVVFAEEENNTTTTTTTTNMMMMYYKKKKKPPPPPPXXXXBBBXXXXXPFFFFFFFFFFNNNNNNNNTTT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,140 @@ +import { rgb8 } from "jsr:@std/fmt/colors" + +export async function readGardenTypeMapData(path: string): Promise { + const txt = await Deno.readTextFile(path); + const lines = txt.split('\n'); + return lines.map(line => line.trim().split('')); +} + +export type GardenCell = { + type: string; + id: number; +} + +export function toGardenMap(map: string[][]) { + const gardenMap: GardenCell[][] = []; + for (let i = 0; i < map.length; i++) { + gardenMap.push([]); + const row = map[i]; + for (let j = 0; j < row.length; j++) { + gardenMap[i].push({ type: row[j], id: 0 }); + } + } + let idGenerator = 1; + const typeMap = new Map(); + const idMap = new Map(); + + function colorArea(x: number, y: number, type: string){ + const stack = [{x, y}]; + while (stack.length > 0) { + const {x, y} = stack.pop()!; + if (x < 0 || x >= gardenMap.length || y < 0 || y >= gardenMap[x].length) { + continue; + } + const cell = gardenMap[x][y]; + if (cell.type !== type || cell.id !== 0) { + continue; + } + cell.id = idGenerator; + stack.push({x: x - 1, y}); + stack.push({x: x + 1, y}); + stack.push({x, y: y - 1}); + stack.push({x, y: y + 1}); + } + } + + for (let i = 0; i < gardenMap.length; i++) { + const row = gardenMap[i]; + for (let j = 0; j < row.length; j++) { + const cell = row[j]; + if (cell.id === 0) { + colorArea(i, j, cell.type); + typeMap.set(cell.type, idGenerator); + idMap.set(idGenerator, cell.type); + idGenerator++; + } + } + } + + return { + gardenMap, + typeMap, + idMap, + } +} + +export function printGardenMap(map: GardenCell[][]) { + for (let i = 0; i < map.length; i++) { + const row = map[i]; + console.log( row.map(cell => rgb8(cell.type, cell.id % 256)).join('')); + } +} + +export function countGardenAreas(map: GardenCell[][]) { + const areas = new Map(); + for (let i = 0; i < map.length; i++) { + const row = map[i]; + for (let j = 0; j < row.length; j++) { + const cell = row[j]; + const currentArea = areas.get(cell.id) ?? 0; + areas.set(cell.id, currentArea + 1); + } + } + return areas; +} + +export function getAreaById(map: GardenCell[][]) { + const areaById = new Map(); + for (let i = 0; i < map.length; i++) { + const row = map[i]; + for (let j = 0; j < row.length; j++) { + const cell = row[j]; + const currentArea = areaById.get(cell.id) ?? 0; + areaById.set(cell.id, currentArea + 1); + } + } + return areaById; +} + +export function getPerimeterById(map: GardenCell[][]) { + const perimeterByType = new Map(); + for (let i = 0; i < map.length; i++) { + const row = map[i]; + for (let j = 0; j < row.length; j++) { + const cell = row[j]; + let currentPerimeter = perimeterByType.get(cell.id) ?? 0; + if (i === 0 || map[i - 1][j].type !== cell.type) { + currentPerimeter += 2; + } + if (j === 0 || map[i][j - 1].type !== cell.type) { + currentPerimeter += 2; + } + perimeterByType.set(cell.id, currentPerimeter); + } + } + return perimeterByType; +} + +if (import.meta.main) { + const path = 'input.txt'; + // const path = "example_1.txt"; + // const path = "example_2.txt"; + // const path = "example_3.txt"; + const data = await readGardenTypeMapData(path); + const {gardenMap, idMap } = toGardenMap(data); + printGardenMap(gardenMap); + const areaById = getAreaById(gardenMap); + const perimeterById = getPerimeterById(gardenMap); + // console.log(areaById); + // console.log(perimeterByType); + const mixed = Array.from(areaById.keys()).map(id => ({ + id, + type: idMap.get(id)!, + area: areaById.get(id)!, + perimeter: perimeterById.get(id)!, + })); + console.log(mixed); + const result = mixed.map(({ area, perimeter }) => area * perimeter).reduce((acc, val) => acc + val, 0); + console.log(result); +} + \ No newline at end of file diff --git a/day_12/solve_2.ts b/day_12/solve_2.ts new file mode 100644 index 0000000..3c91155 --- /dev/null +++ b/day_12/solve_2.ts @@ -0,0 +1,71 @@ +import { readGardenTypeMapData, toGardenMap, printGardenMap, getAreaById, getPerimeterById, GardenCell } from "./solve_1.ts"; + +const pattern = { + "0000": 4, + "1000": 4, + "0100": 0, + "1100": 2, + "0010": 4, + "1010": 4, + "0110": 2, + "1110": 4, + "0001": 0, + "1001": 2, + "0101": -2, + "1101": -2, + "0011": 0, + "1011": 2, + "0111": 0, + "1111": 0, +} as Record; + +function getSideById(gardenMap: GardenCell[][]) { + const sideById = new Map(); + function addSide(id: number, side: number) { + const currentSide = sideById.get(id) ?? 0; + sideById.set(id, currentSide + side); + } + + for (let i = 0; i < gardenMap.length; i++) { + for (let j = 0; j < gardenMap[i].length; j++) { + const cell = gardenMap[i][j]; + const id = cell.id; + const sides = [ + gardenMap[i - 1]?.[j - 1]?.id ?? -1, + gardenMap[i - 1]?.[j]?.id ?? -1, + gardenMap[i - 1]?.[j + 1]?.id ?? -1, + gardenMap[i]?.[j - 1]?.id ?? -1, + ]; + const sideKey = sides.map(s => s === id ? 1 : 0).join(''); + const addedSide = pattern[sideKey]; + addSide(id, addedSide!); + } + } + + return sideById; +} + +if (import.meta.main) { + const path = 'input.txt'; + // const path = "example_1.txt"; + // const path = "example_3.txt"; + // const path = "example_4.txt"; + // const path = "example_5.txt"; + const data = await readGardenTypeMapData(path); + const {gardenMap, idMap } = toGardenMap(data); + printGardenMap(gardenMap); + const areaById = getAreaById(gardenMap); + const sideById = getSideById(gardenMap); + // console.log(areaById); + // console.log(perimeterByType); + const mixed = Array.from(areaById.keys()).map(id => ({ + id, + type: idMap.get(id)!, + area: areaById.get(id)!, + side: sideById.get(id)!, + })); + console.log(mixed); + const result = mixed.map(({ area, side }) => area * side).reduce((acc, val) => acc + val, 0); + console.log(result); +} + \ No newline at end of file