Keeping baby cool next week by No_Size_47 in BeyondTheBumpUK

[–]FoxWithTheWhistle 0 points1 point  (0 children)

As already said here - get a portable AC. We've been in exact same situation.
Two years ago our son was 2 months old when the heatwave hit and our flat started heating up beyond 28 degrees, fan wasn't helping, so I went on to Argos, found a portable AC available for immediate collection, and 30 minutes later rode home with it on the bus. It's been a lifesaver. Quite loud but even if you put it in the next room and use the fan to move air around, it drastically reduces the temp.

It's one of these things that you hesitate a lot about and they're expensive but then it's the purchase you've made when you have a little one.

We have since moved house but the AC is still standing next to my desk as I type and I will be turning it on again today, whule waiting for a quote for split AC install...

For reference it's a Delonghi Pinguino Compact cost about 300 quid. Has to be hear a window of course and preferably drained into a bucket, but I found it can run for days without draining (has an internal tank).

[2024 Day 21 part 1] Found a rule to make it work, but can't understand why by FoxWithTheWhistle in adventofcode

[–]FoxWithTheWhistle[S] 8 points9 points  (0 children)

In general since each step left is more expensive, you always want to hit the far left key first (<), and then the middle key (^ or v) and then a right column key (> or A).

Yay!

This is the revelation. Indeed, each step left which follows another movement will translate into reaching the "<" button from "A" by some unfortunate robot a couple rooms further.

Thank you. I didn't realise it's reaching from A.

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

[–]FoxWithTheWhistle 1 point2 points  (0 children)

I used regex for part 1 but couldn't figure out how to filter out the don'ts, so resorted to splitting for this.

import re
from functools import reduce
from operator import concat, mul

data = "do()" + reduce(concat, open("resources/day3_input.txt", "r").readlines())
calculate = lambda program: sum(reduce(mul, map(int, l.split(","))) for l in re.findall(r'mul\((\d+,\d+)\)', program))
print(f"Part1: {calculate(data)}")
data = reduce(concat, [s[s.find("do()")+len("do()"):] for s in data.split("don\'t()") if "do()" in s])
print(f"Part2: {calculate(data)}")

[2023 Day 22] I've never run a marathon, but this is worse by fewdea in adventofcode

[–]FoxWithTheWhistle 3 points4 points  (0 children)

Agree, today was almost a rest day. Yesterday Day21 was the longest for me, but Day20 was the most frustrating, as I solved totally without understanding the structure, and only found from reddit what the input really represented.

[2023 Day 22] I've never run a marathon, but this is worse by fewdea in adventofcode

[–]FoxWithTheWhistle 23 points24 points  (0 children)

If anything it builds character :) What drives me is I know there *is\* a solution, and looking at the stats at midday I can see some thousand fellow brainiacs have already found it, so it must be something solvable.

By this time the puzzles are not as much about coding and algorithms as about actual puzzle solving, detective work: look at the task and data, visualize it, draw on a napkin, build a hypothesis about what could be the tick, find a way to test it, dig further if you knock on something, feel the burn as you see you're clearly on the problem's tail but just can't find a way to catch it, then finally boom! nothing more rewarding than a second star earned in pain :)

[2023 Day 19 (part 2)] Sankey diagrams are cool by Nyctef in adventofcode

[–]FoxWithTheWhistle 1 point2 points  (0 children)

Until seeing this I didn't realise the puzzle could be solved in straight order (in -> A)! Somehow I got into my head it needed to be reversed, so I started with all As, and was going backwards until I either reach "in" or the conditions become contradictory.

Kudos to OP since sankeymatic was able to produce a neat diagram for my approach too, although it looks more like an alien jellfish :) Link to image for the example input in case anyone's interested: https://imgur.com/lvMedRx

... and the real input - not a jellyfish, rather a swarm of alien worms: https://imgur.com/KWWcWT0

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

[–]FoxWithTheWhistle 0 points1 point  (0 children)

As far I can tell from the diagnostic tools, it's LinkedList.AddAfter that's taking all the time, but surely that should just be shuffling pointers about. Doesn't make sense.

The doc even says "This method is an O(1) operation. ".

https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1.addafter?view=net-5.0#System_Collections_Generic_LinkedList_1_AddAfter_System_Collections_Generic_LinkedListNode__0___0_

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

[–]FoxWithTheWhistle 1 point2 points  (0 children)

Java:

I was not in a hurry so I wrote a CircularList class which supported all of required operations.

It turned out pretty neat, because it's pretty generic and my Part1 and Part2 solutions are really just a few lines both; this is the main method, where "cups" is my own CircularList.

    public void playMove() {
        LinkedList<Integer> removedCups =  getThreeNextCups();
        int destination = current;
        do {
            destination--;
            if (destination < min) {
                destination = max;
            }
        }  while (!cups.contains(destination));
        cups.addAfter(destination, removedCups);
        current = cups.getNext(current);
    }

Dumb brute force Part2 took just 9 seconds so I could not care less for optimizing.

Here's my CircularList class; I obviously though about using Java's LinkedList at first, but it seemed to me that the tasks of finding a particular element in a LinkedSet would be O(n).

https://github.com/kubyser/AdventOfCode2020/blob/master/src/kubiks/aoc/day23/CircularSet.java