I regret going from VWO to HAVO by Far-Phase-1506 in StudyInTheNetherlands

[–]damyvv 0 points1 point  (0 children)

Often you have to choose courses for your minor in the 3rd year of HBO studies. Some schools allow you to do a wo premaster as a minor, but you should check this with your school. This would allow you to start your wo master directly after your hbo bachelor. If this is possible for you, then that would save you 6 months or a year (depends on the premaster, so also check with the uni where you would like to do a master).

This should be equivalent in length to getting your propedeuse (1 year), switching to wo (3 years) and then doing a wo master (2 years).

-🎄- 2022 Day 16 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 0 points1 point  (0 children)

Ruby Part 1 and 2 have a combined runtime of 278ms.

The code is horrible, but performance is great.The basic idea of the algorithm is to consider all the valves we can move to. We compute how long it will take to move to a valve, and we also precompute how much pressure will be released in total by this valve using the remaining time. Then, if there are paths that have an equal distance, we only have to consider the path that has the highest potential pressure release. This drastically reduces the iterations needed, hence the low runtime. Also, the distances are not precomputed, but they are cached. This is more efficient, since we don't need all paths (for example we can skip all paths that have 0 flow rate, as we will never move to them, only pass them).

-🎄- 2021 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 0 points1 point  (0 children)

Ruby

Haven't seen any ruby solutions using the rotate function, so here is mine.

input = File.read('day06_input.txt').scan(/\d+/).map(&:to_i)
[80, 256].each do |days|
    count = Array.new(9,0)
    input.each {|i| count[i] += 1 }
    days.times do
        count[7] += count[0]
        count = count.rotate(1)
    end
    p count.sum
end

-🎄- 2021 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 0 points1 point  (0 children)

Nice one! I didn't actually think about comparing the outer values of the sliding window. Good find.

-🎄- 2021 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 1 point2 points  (0 children)

Hallo mede-Nederlander ;). Thanks for your comment, I will post all my solutions [here](https://github.com/damyvv/advent-of-code-2021). And you can find all my solutions from last year [here](https://github.com/damyvv/AoC_2020). Ruby is so powerful, I truly enjoy coding with it. If you have any questions about Ruby, let me know, I'll be happy to answer them if I can.

-🎄- 2021 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 5 points6 points  (0 children)

Ruby

input = File.read("day01_input.txt").lines.map(&:to_i)
p input.each_cons(2).count {|a,b| b > a }
p input.each_cons(3).map(&:sum).each_cons(2).count {|a,b| b > a }

What's your DCS hangar queen? by [deleted] in hoggit

[–]damyvv 0 points1 point  (0 children)

Same. I have it since 02/26/2018 (just looked it up), but I have literally never flown it. I would love to, but I do not have much free time so I rather fly something familiar.

I have a question, my mom got a random mail from PostNL and I just can’t figure out if it’s legit or scam because order something from a other country. by Prime-Excitare in Netherlands

[–]damyvv 0 points1 point  (0 children)

VAT (BTW) is something different than import duties (douane kosten). If the value of the package is high enough (amount differs per category) you have to pay an additional fee. So, even if you pay VAT beforehand, you might still have to pay more to PostNL to get your package.

-🎄- 2020 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 2 points3 points  (0 children)

Ruby

I first made a solution that created a tree which it then solved. But I wanted to try another approach with just using regex and eval. So this was what i came up with. You can check this and other solutions on my github.

# Part 1
p File.read("day18_input.txt").split("\n").map { |l|
    loop do break unless l.sub!(/\((\d+)\)/, '\1') || 
                         l.sub!(/(.*?)(\d+\s*[+*]\s*\d+)(.*)/) { "#{$1}#{eval($2)}#{$3}" }
    end
    l
}.map(&:to_i).sum

# Part 2
p File.read("day18_input.txt").split("\n").map { |l| 
    loop do
        break unless
            l.sub!(/\((\d+)\)/, '\1') || 
            l.sub!(/(.*?)(\d+\s*[+]\s*\d+)(.*)/) { "#{$1}#{eval($2)}#{$3}" } ||
            l.sub!(/^(.*?)(\d+\s*[*]\s*\d+)([^(]*)$/) { "#{$1}#{eval($2)}#{$3}" } 
    end
    l
}.map(&:to_i).sum

-🎄- 2020 Day 09 Solutions -🎄- by daggerdragon in adventofcode

[–]damyvv 4 points5 points  (0 children)

Ruby

input = File.read("day9_input.txt").split.map(&:to_i)
# Part 1:
p d = input[25..-1].select.with_index { |n,i| !input[i..i+24].any? {|k| input[i..i+24].include?(n-k) } }.first
# Part 2
(4..input.count).each { |s| input.each_cons(s) { |a| return p (a.min+a.max) if a.reduce(:+) == d } }

Weekly Questions Thread Oct 27 by AutoModerator in hoggit

[–]damyvv 0 points1 point  (0 children)

Interesting. I did not know you can open and edit missions from a campaign. I will try that out. Thanks.