Unable to load image

rDrama Advent of Code Day 10: Hoof It

https://adventofcode.com/2024/day/10

I hope this fine morning finds you well, saars.

The word of the day is: graphs!

Rdrama leaderboard. Invite code: 632268-30587026, you need to log in first.

Announcement post with useful links.

@Merryvann please pin this and unpin Day 9.

17
Jump in the discussion.

No email address required.

val dir4 = listOf(1 to 0, -1 to 0, 0 to 1, 0 to -1)
typealias Pairs = MutableCollection<Pair<Int,Int>>
fun main () {
    val grid = File("src/d10.input").readLines().map { it.toCharArray()
        .map { c -> c.digitToInt() } }
    val rRange = grid.indices; val cRange = grid[0].indices

    fun recurse (r:Int,c:Int,v:Int,set:Pairs): Pairs {
        if (r in rRange && c in cRange && v == grid[r][c]) {
            if (v == 9)
                set.add(r to c)
            else
                dir4.forEach { (dr,dc) -> recurse(r+dr, c+dc, v+1, set) }
        }
        return set
    }

    fun fold (newSetFn:()->Pairs) = rRange.sumOf { r ->
        cRange.sumOf { c -> recurse(r,c,0,newSetFn()).size }
    }
    println(fold { HashSet() })   // Q1
    println(fold { ArrayList() }) // Q2
}

i may consider building one of them aoc libs for this (like grid creation, folding/summing),

but part of the fun for me is deriving this from language level abstractions, so idk

Jump in the discussion.

No email address required.

Reported by:

Jeet or just a kotlin enjoyer?

Jump in the discussion.

No email address required.

u think i'm a jeet? lol

nah i've been doing typescript for the last 5 years but recently took a java position to "enhance my BE skillset" (also FE engineers aren't real engineers)

god i hate java, and decided to do aoc in kotlin.

tbh i am really enjoying it

Jump in the discussion.

No email address required.

Kotlin isn't bad. Just usually see jeets on the jvm and then it sucks.

Jump in the discussion.

No email address required.

Indian devs generally only use the JVM with a disgusting framework like Spring or Java EE. They can't write Java directly. Ask them to write a method to sum two numbers and they'll add dependency injection.

Jump in the discussion.

No email address required.

they'll add dependency injection.

it's only been 2 months and i already feel triggered by this

Jump in the discussion.

No email address required.

I was once a consultant on a big project, one of maybe 150 software engineers in a room. One day we had a training session on Test Driven Development where everyone was given an hour to write a Roman numeral converter by writing unit tests then implementing the code. The idea was that you'd write a test for converting 1-10 into I-X, then write the code to make that test pass, and keep going up as high as you could.

At the end of the hour the instructor asked how high everyone had gone. One team of two senior Capgemini Java engineers (Indian) said "we didn't get anywhere because we couldn't figure out how to install JUnit". I looked over at their machines and they were on the JUnit website and had spent the whole hour trying to find "junit.exe".

Jump in the discussion.

No email address required.

i believe the codebase i just started on has mostly not been written by the jeets actually, it's probably better than ur average jvm codebase

but it's java, so it still stucks. grpc used for all objects. dagger injection half the things. a few services i can't even follow flow because some righteous dumbass decided to use dependency injection/production to determine overarching execution flow :marseygunshotsuicide:

it's not really even java anymore, it's an annotated monster bolted together to overcame java boilerplate heck,

but really just ends up in it's own wonky boilerplate heck

i wish we just used kotlin

Jump in the discussion.

No email address required.

Whoever wrote the codebase would have done the exact same thing in kotlin unfortunately.

Jump in the discussion.

No email address required.

magic dependency injection flow was written by a slav

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.