Rocky Linux casual weekly Advent of Code Meetup

When: Wednesdays 4:30-6pm During the month of December
Where: Google Calendar Event | Zoom link | Mattermost | Forum

Hey Everyone!

In the spirit of celebrating holidays with friends near and far, The Rocky Linux Community and Bates College will be hosting a casual weekly Advent of Code meetup via Zoom and the AoC forum thread each Wednesday evenings of December, 4:30-6pm EST. All are welcome to tune in to hang out, exchange esolang solutions, puzzle through technical minutiae and enjoy visiting with a friendly, welcoming cohort.

About the AoC:

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill levels that can be solved in any programming language you like. - AoC Website

2 Likes

Please share your name, timezone and pronouns if you’d like to participate- synchronously via Zoom otherwise! :smile_cat: I am planning on sending participation stickers / pins to anyone who’d like to play ball.

I’ll begin- :rainbow:

My name is Jess Sullivan- I am based in Maine, US (EST timezone). My pronouns are she/her.

I’ve decided to play my AoC this year in TypeScript: repo. Here’s my solution to the first question:

import { readFileSync } from "fs";

let arr_a: number[] = [];
let arr_b: number[] = [];
let result_part_1: number = 0
let result_part_2: number = 0

const arr_f = readFileSync(process.argv.slice(2)[0]).toString().replace( /\n/g, "   " ).split("   ");

for (let i = 0; i < arr_f.length-1; i=i+2) {
    arr_a.push(Number(arr_f[i]));
    arr_b.push(Number(arr_f[i+1]));
}

arr_a.sort(function (a, b){return a-b})
arr_b.sort(function (a, b){return a-b})

for (let i = 0; i < arr_f.length/2; i++) {
    let diff = arr_a[i] - arr_b[i]
    result_part_1 += diff < 0 ? -diff : diff;
}

console.log('the answer to problem 1, part 1 is: ' + result_part_1)

const reps = {};
arr_b.forEach(function (x) { reps[x] = (reps[x] || 0) + 1; });

for (let i = 0; i < arr_f.length/2; i++) {
    result_part_2 += reps[arr_a[i]] !== undefined ? arr_a[i] * reps[arr_a[i]] : 0
}

console.log('the answer to problem 1, part 2 is: ' + result_part_2)

Cheers,
-Jess

Love this, thanks for stepping up to the plate and working on this, Jess!

I’ll try and join this wednesday. I’m capturing my answers in this repo: https://git.shrug.pw/neil/aoc2024/

1 Like

Awesome Jess. Thank you for hosting this. Looking forward to participating this wednesday.

:partying_face:

1 Like

Evening y’all! Find the Zoom link here. I’ll be continuing along in TypeScript land this evening- feel welcome to bop in and out. :smile_cat:

Thanks @grammaresque for pulled together some nifty graphics for sharing on socials :rocket: