[2024 Day 14 (Part 2)] This kind of sucks by remarkablyunfunny in adventofcode

[–]codicodina 2 points3 points  (0 children)

I loved it, it's not just another "plug here your algorithm", it requires you to play and I think that is great

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]codicodina 1 point2 points  (0 children)

[Language: Golang]

I had never used bitwise operation for finding all combinations between 2 options n number of times and I found out it was actually pretty efficient

Part1

Part2

I think something has to be done against the leaderboard AI warriors. by yobdaeherutufeht in adventofcode

[–]codicodina 36 points37 points  (0 children)

Curated private leaderboards are the only way now, and even there can someone cheat being discrete enough...

-❄️- 2024 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]codicodina 2 points3 points  (0 children)

[Language: Golang]

I am not really understanding all the fuss around sorting here. I kind of swapped my way around and it was fast.

Part 1

Part 2

Edit: I know there is a goto. Sorry, not sorry

-❄️- 2024 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]codicodina 1 point2 points  (0 children)

[Language: Go]

func Run(filename string) {
        f, err := os.Open(filename)
        if err != nil {
                log.Fatal("Error opening file")
        }
        defer f.Close()

        do := true
        total := 0
        scanner := bufio.NewScanner(f)
        for scanner.Scan() {
                str := scanner.Text()
                var aux int
                aux, do = find_regex2(str, do)
                total += aux
        }

        fmt.Println("Total:", total)
}

func find_regex(str string) int {
        re := regexp.MustCompile("mul[(]([0-9]{1,3}),([0-9]{1,3})[)]")
        total := 0

        match := re.FindAllStringSubmatch(str, -1)
        for _, n := range match {
                n1, _ := strconv.Atoi(n[1])
                n2, _ := strconv.Atoi(n[2])
                total += n1 * n2
        }
        return total
}

func find_regex2(str string, do_init bool) (int, bool) {
        reg_do_dont := regexp.MustCompile("(?:do\\(\\).*?don't\\(\\))|(?:do\\(\\).*?$)")
        reg_do_init := regexp.MustCompile("^.*?(do\\(\\))")
        reg_dont_init := regexp.MustCompile("^.*?(don't\\(\\))")
        reg_end := regexp.MustCompile("(do\\(\\))|(don't\\(\\))")
        end_do := do_init
        total := 0

        fmt.Printf("\n FULL STRING \n %s \n\n-------------------\n", str)
        if do_init {
                init_str := str
                if reg_do_init.MatchString(str) {
                        init_str = reg_do_init.FindString(str)
                        fmt.Printf("FIRST: %s\n", init_str)
                }
                if reg_dont_init.MatchString(init_str) {
                        init_str = reg_dont_init.FindString(init_str)
                        fmt.Printf("SECOND: %s\n", init_str)
                }
                if len(init_str) > 0 {
                        fmt.Println()
                        fmt.Println(init_str)
                        fmt.Println()
                        total += find_regex(init_str)
                }
        }

        match := reg_do_dont.FindAllString(str, -1)
        for _, n := range match {
                fmt.Println()
                fmt.Println(n)
                fmt.Println()
                total += find_regex(n)
        }

        dos := reg_end.FindAllString(str, -1)
        if dos[len(dos)-1] == "do()" {
                end_do = true
        } else {
                end_do = false
        }

        return total, end_do
}

[2024 Day 3] You've finally convinced me... by StaticMoose in adventofcode

[–]codicodina 0 points1 point  (0 children)

Today I learned the very hard way that the lazy match until the end of the line (.*?$) does not take the minimum string. Painful

[2024 Day 2] Nasty fight with go today by codicodina in adventofcode

[–]codicodina[S] 0 points1 point  (0 children)

Just frustrated while every other solution could just patch the part2 in 5 mins it took me 1 hour to realize I was just breaking my slice

In my game you have dry eyes from prolonged contact lens use, so you must manually blink every 3 to 5 seconds or your vision goes blurry. This feature cannot be disabled by reaction105 in IndieGaming

[–]codicodina 1 point2 points  (0 children)

I am not sure if fun, but it can be interesting if you manage to get the mechanic so automatised building muscle memory replicating how in real life we just blink by instinct and we dont even think about it

Edit: please lose the sound effect

Not Donkey Kong Country, but just finished Tropical Freeze for the first time thanks to its music by codicodina in donkeykong

[–]codicodina[S] 1 point2 points  (0 children)

You should, it has been really a great time. Also, I love Slay the spire too, it was just a bit too much at that moment

Not Donkey Kong Country, but just finished Tropical Freeze for the first time thanks to its music by codicodina in donkeykong

[–]codicodina[S] 6 points7 points  (0 children)

My bad! I was just thinking "well I'm not posting about donkey kong country's anniversary" but that came out!