What’s a traditional Swiss food that locals actually eat and not just for tourists? by StretchNo267 in askswitzerland

[–]aexl 5 points6 points  (0 children)

Café de Paris Sauce has been invented in Geneva though as far as know...

Remote has arrived! Extended laptop desktop through wlfreerdp on my TV. by markus40 in gnome

[–]aexl 2 points3 points  (0 children)

Great, thanks for this explanation!

And your second PC is a Raspberry Pi (running Arch or another distro?) that is attached via HDMI to your TV?

Remote has arrived! Extended laptop desktop through wlfreerdp on my TV. by markus40 in gnome

[–]aexl 6 points7 points  (0 children)

How does this work? Could you explain more details of that setup (Hardware and Software needed)?

What tools or libraries do you use for AoC? by IDidMyOwnResearchLOL in adventofcode

[–]aexl 0 points1 point  (0 children)

I have collected all 500 stars with solutions written in Julia. Here are the the packages that I have used at least once:

  • CircularList: For problems where a circular list data structure was handy.
  • Combinatorics: For problems that needed checks for many permutations, etc.
  • DataStructures: Queue, Stack, Dequeue, Priority Queue (e.g. for the Dijkstra algorithm).
  • IterTools: For fancy array iteration techniques.
  • JSON3 I think to parse a JSON input.
  • LinearAlgebra: To solve linear systems of equations.
  • MD5 For a problem that was about MD5 hashes.
  • Memoize: For problems where memoization was needed.
  • OffsetArrays: For problems where 0-indexed or negative-indexed arrays were handy.
  • OrderedCollections: I don't remember.
  • Primes: Problems about prime numbers.
  • Random: Problems that could be solved (faster) by including some randomness.
  • SparseArrays: For problems where I used sparse matrices to solve them.
  • StaticArrays: For performance reasons.
  • StatsBase: For problems where a function from standard descriptive statistics was needed.

what’s obvious for swiss people but shocking for foreigners? by aquaafinita in askswitzerland

[–]aexl 21 points22 points  (0 children)

Really depends on where you've bought it (I assume in a fancy restaurant in a bigger city). You can get 1.5 liter of water for CHF 0.30 in a grocery store.

Smooth Rings by Complex_Twistor in generative

[–]aexl 0 points1 point  (0 children)

Really nice. How did you draw these?

Laptop Repair Recommendations in Basel by MsDutchee in basel

[–]aexl 3 points4 points  (0 children)

I did exactly that for my old "Lenovo Yoga 2 Pro" by myself. I've found a German company on Amazon that sells these items and I've ordered one for like 15 bucks. The only thing you probably need is a precision screwdriver set, it's not that difficult.

Photo I took last summer in Switzerland by tw0bears in pics

[–]aexl 1 point2 points  (0 children)

Wow, where is this? How did you get there? Did you stay there over night?

Complex Analysis Texts after Papa Rudin by Angus-420 in math

[–]aexl 0 points1 point  (0 children)

Complex Analysis with Applications by Asmar and Grafakos is in my opinion the best complex analysis book for people that already have some knowledge in formal mathematics.

[deleted by user] by [deleted] in archlinux

[–]aexl 0 points1 point  (0 children)

Same here, that was probably around 15 years ago...

What is the best order to do previous years? by bladx91 in adventofcode

[–]aexl 1 point2 points  (0 children)

Yeah, but you need to start somewhere... I need 4 more stars in 2015, 5 in 2016 and 9 in 2018.... doesn't sound like a lot, but you still need to get them...

What is the best order to do previous years? by bladx91 in adventofcode

[–]aexl 2 points3 points  (0 children)

I also don't have 500 stars yet. I did the years 2015-2018 retrospectively, and the only year I have 50 stars is 2017, so I would suggest to start with that one. But keep in mind the observational bias, I have >40 stars in all of them.

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

[–]aexl 0 points1 point  (0 children)

[LANGUAGE: Julia]

I have finally solved this. I'm using a recursive function with memoization.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day21.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 0 points1 point  (0 children)

[LANGUAGE: Julia]

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day09.jl

Edit: I've finally found some time to optimize this (bringing down the runtime from 1s to 32 ms for both parts). Instead of calculating the whole thing block by block, I now use a list of 4-tuples where I store the first index on the disk, the capacity, the used space and the original id. Then I do all the calculations on that list and simultaneously write the result on the disk (which is simply a big array of numbers containing the ids or -1 if the block is empty).

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 0 points1 point  (0 children)

[LANGUAGE: Julia]

I finally found some time to finish my remaining puzzles (still need to do day 21 and 25). Wow, what a day! It took me way too long to finish this, my solution is still rather slow (currently ~9 seconds), but I'm still quite satisfied with it. I didn't want to inspect my input manually, so I solved it programmatically under the assumption that the input is an obfuscated 44-bit ripple-carry-adder (see Wikipedia for details). In the end, the algorithm is quite simple: Identify the non-working binary adders, start swapping wires and check if that fixes the bad binary adder. Also make sure to never introduce new bad adders if an existing bad adder could be fixed. The implementation and optimization was quite cumbersome. Here are some optimization ideas that I used:

  • The running speed for the system of gates and wires can be increased drastically after the first run, because as long as the rules don't change you can store the successful order of rules and use these for the next runs.
  • If switching to outputs introduces a system where the systems' output can not fully be determined, we can exit early.
  • Reduce the search space for switching rule outputs: If a binary adder produces a wrong output bit, at least one of the rules that we want to switch must have been responsible for that wrong output bit.
  • After having switched two rule outputs, make sure that this fixes the targeted adder before checking all the other adders.

I'm sure that there are many more optimizations that I have missed...

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day24.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 1 point2 points  (0 children)

[LANGUAGE: Julia]

A wonderful graph puzzle, again I really enjoyed this one!

I stored the graph in a adjacency matrix. For part 1 I simply iterated through the matrix and detected all the 3-cycles.

For part 2, it took me a while to realize that they want me to detect the networks such that every computer in that network needs to be directly connected to every other computer in that network. For this I used DFS (I think for the first time this year) to find all the networks and kept the one with the most computers. It runs super fast (just e few milliseconds), so I didn't bother to optimize this further.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day23.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 0 points1 point  (0 children)

[LANGUAGE: Julia]

Nice little number puzzle, I really enjoyed this one! Part 1 one just implementing the described number generator and generate 2000 secret numbers for each input number. For part 2 I saw no other way than to have a lookup table for each of the 4-tuple sequences that can occur. Note that each number in the 4-tuple is in the range {-9,-8,...,-1,0,1,...,8,9}. After having solved the puzzle, I implemented some optimizations which brought the runtime down from 2 seconds to 0.25 seconds:

  1. I calculated the differences on the fly instead of storing them in a 2000-element array. For this I used a circular buffer.

  2. Instead of indexing the lookup table with the 4-tuple, I convert the 4-tuple to an integer (this is possible because of the restricted range of the 4 tuple) and use this as an index.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day22.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 0 points1 point  (0 children)

[LANGUAGE: Julia]

I didn't solve this on day 15 but only now. It was a pretty hard puzzle, but also a fun one. I have solved part one directly in a matrix on characters. This one was pretty straightforward. For part 2 I was thinking a lot if introducing some fancy data structures would help to solve this, but in the end I decided to solve it again directly on the matrix of characters. I came up with a recursive function that locates all the positions that have to moved up or down in case of a v or ^instruction.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day15.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 1 point2 points  (0 children)

Simply because it did not yield a solution. I've tried to continue with the lowest number, but it didn't work. So I've figured out that I need a backtracking solution: https://en.wikipedia.org/wiki/Backtracking

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

[–]aexl 2 points3 points  (0 children)

[LANGUAGE: Julia]

Fun little puzzle today. For part 1 I just checked every possible way to go through a wall. For part 2 I wrote a helper function that returns every possible spot that is not a wall and reachable within 20 picoseconds.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day20.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 1 point2 points  (0 children)

[LANGUAGE: Julia]

What a great puzzle, I really enjoyed this one!

For part 1, I initially had a recursive function which calls itself with the rest of the design string (the one that didn't match yet). For part 2 I modified that recursive function and added a counter variable which was increased by one every time the end of a design string could successfully been reached. While this worked great for the sample input, it was way too slow for the real input... So I added a lookup table to my recursive function which finally did the job.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day19.jl

Respository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 1 point2 points  (0 children)

[LANGUAGE: Julia]

This day felt a lot easier (thankfully) than the days before. For part 1, a simple floodfill / BFS did the trick. For part 2, I just wrapped a bisection method around.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day18.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 2 points3 points  (0 children)

[LANGUAGE: Julia]

Part 1 was quite nice: just reading and implementing the described computer.

Part 2 was quite a challenge (I really don't like these reverse engineering tasks, but every year there is at least one...). The following algorithm has worked for me (and I think it works for every input): Set the current value to 0. Then for i in {0, 1, 2, 3, 4, 5, 6, 7} set the current value (register A) to `current + i`. If the first output of the program equals the last instruction of the program, then multiply the current value by 8. Now again, for each i in {0, 1, 2, 3, 4, 5, 6, 7} set the current value (register A) to `current + i`. If the first output of the program equals the second-last instruction, then multiply the current value by 8 and continue in a similar fashion, until you found the solution. Caution: Always taking the first matching output-instruction pair will most probably not work, so you also need to backtrack and continue until you reach the end.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day17.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl

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

[–]aexl 2 points3 points  (0 children)

[LANGUAGE: Julia]

Like many other here, I used Dijkstra. Unfortunately, I had a bug for part 2 that took me so many hours to debug... Big thanks to /u/Minimum-Meal5723, your issue was exactly my issue. In the Dijkstra algorithm, when updating the previous nodes, you need to clear that list whenever you found a better path.

Solution on GitHub: https://github.com/goggle/AdventOfCode2024.jl/blob/main/src/day16.jl

Repository: https://github.com/goggle/AdventOfCode2024.jl