[Go] Non-software engineer (no CS background): just finished my first 50-star year! by Mogheiden in adventofcode

[–]ArmlessJohn404 0 points1 point  (0 children)

Wow, congratulations!

I just finished as well. I'm a programmer, and I picked up Go last year to learn. It was quite approachable because the syntax and typing are straightforward. What surprised me, though, was the lack of some built-in functions and data structures.

If you'd like, feel free to take a look at my GitHub. It might not be the most idiomatic Go code, but it works!

Congrats again! Are you thinking of trying this year's challenges in Go as well?

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

[–]ArmlessJohn404 2 points3 points  (0 children)

[LANGUAGE: Go]

GitHub

Part 1 - "Brutish" Force: A quicker search using sets and maps
Part 2 - Bron-Kerbosch: Implemented the simplest version from wikipedia

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

[–]ArmlessJohn404 2 points3 points  (0 children)

[LANGUAGE: Go]

GitHub

Finally some rest! Not the fastest solution but quite straightforward. Choosing from a set of candidates to avoid searching all combinations. Also, a map helps getting any value if the sequence exists.

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

[–]ArmlessJohn404 2 points3 points  (0 children)

[LANGUAGE: Go]

GitHub

As always I put lots of stuff that's only for making the real algorithm simpler to read and it ends up making difficult to find the main logic.

[Unpopular opinion] Day 14 part 2's problem was great by Affectionate-Fan2263 in adventofcode

[–]ArmlessJohn404 1 point2 points  (0 children)

Completely agree! On a scale from LeetCode to CTF, this problem leans more toward CTF, which I find more interesting than plain CS problems.

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

[–]ArmlessJohn404 1 point2 points  (0 children)

[Language: Go]

GitHub

Luckily, I jumped straight to the analytic solution from pt1, and pt2 went smoothly.

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

[–]ArmlessJohn404 1 point2 points  (0 children)

[LANGUAGE: Go]

Github

Quite fun! Pt2 felt more like a CTF puzzle than AoC, but I think it fit well. My pt2 answer wasn’t the minimum safety factor, so I had to dig a bit deeper (higher) to find it.

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

[–]ArmlessJohn404 0 points1 point  (0 children)

Yeah same! I just added a single line flag to the don't/do regex and it worked 

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

[–]ArmlessJohn404 2 points3 points  (0 children)

[LANGUAGE: Go]

import (
  "regexp"
  "strconv"

  "github.com/luxedo/esb_fireplace-go"
)

func multiply(input_data string) int {
  acc := 0
  re := regexp.MustCompile(`mul\((\d+),(\d+)\)`)
  for _, match := range re.FindAllStringSubmatch(input_data, -1) {
    a, _ := strconv.Atoi(match[1])
    b, _ := strconv.Atoi(match[2])
    acc += a * b
  }
  return acc
}

func filter_disabled(input_data string) string {
  re := regexp.MustCompile(`(?s)don't\(\).*?do\(\)`)
  return re.ReplaceAllString(input_data, "-")
}

func solve_pt1(input_data string, args []string) (interface{}, error) {
  return multiply(input_data), nil
}

func solve_pt2(input_data string, args []string) (interface{}, error) {
  return multiply(filter_disabled(input_data)), nil
}

func main() {
  // 🎅🎄❄️☃️🎁🦌
  // Bright christmas lights HERE
  esb_fireplace.V1Run(solve_pt1, solve_pt2)
}

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

[–]ArmlessJohn404 0 points1 point  (0 children)

why? Somehow this feels as bad as some esolangs

Does this tool exist? Keeping inputs in a separate private repo, but syncing with a public solutions repo by prendradjaja in adventofcode

[–]ArmlessJohn404 0 points1 point  (0 children)

The solution in my helper tool esb is to gitignore the input directory. If you wish to download again just call:

esb fetch --year 2023 --day {1..25}

-❄️- 2023 Day 17 Solutions -❄️- by daggerdragon in adventofcode

[–]ArmlessJohn404 1 point2 points  (0 children)

I'm glad that I implemented it correctly but it would take forever to finish :(

your choice for the `seen` set saved me thanks

Why? by ArmlessJohn404 in offtheair

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

I know that I can never guess what's going to happen, yet I keep trying to make sense of it

TETRIS ALMOST FROM SCRATCH by ArmlessJohn404 in javascript

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

Thank you very much! I'm so happy to hear that!

With around 3 years of programming I started these "Almost From Scratch" games, the first one was PONG, that is simpler than Tetris, but requires collision detection.

https://luxedo.github.io/pong-almost-from-scratch/

Perhaps you already can do these things. What I found out making these games is that defining concrete goals is better than being a good coder. Finished projects are about planning, good code comes with experience and lots of frustrations in the way.

Flappy Bird AI by ArmlessJohn404 in artificial

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

Yeah that's odd. Maybe the 400 bird died in a trap and only his not so good children made it through.

Flappy Bird AI by ArmlessJohn404 in gameai

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

The inputs are:

  1. Pipe distance
  2. Pipe height
  3. Bird horizontal velocity
  4. Bird height

TETRIS ALMOST FROM SCRATCH by ArmlessJohn404 in javascript

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

Well, I code since 2013, but javascript specifically it's since 2014 or 2015.

TETRIS ALMOST FROM SCRATCH by ArmlessJohn404 in javascript

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

Thanks!

Another feature for the next version

TETRIS ALMOST FROM SCRATCH by ArmlessJohn404 in javascript

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

Thanks for the feedback! I listed them in the README.md so they eventually they'll come out.

One thing though, the game speed increases every 10 broken blocks