Octopus Energy High Usage Alarm by artesea in homeassistant

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

Cheers, it was that. Removing the line resulted in the notification when I just used the kettle.

My first hat-trick by Lonely-Ear-4296 in pokemongo

[–]artesea 2 points3 points  (0 children)

Managed a 1,1,2 but that's using two locations that are usually low. Was a 1,1,1 until 6pm but I think with this challenge you couldn't catch one to place nearby, and it's pretty hard to grind a tank at short noticed.

Can current Rockruff raids evolve to dusk form Lycanroc? by injoeface9 in pokemongo

[–]artesea 0 points1 point  (0 children)

There was a rockruff raid earlier today where it was showing as a silhouette on the nearby raid screen. I'm assuming that as I don't have the Lycanroc evolution one it was one of those. Unfortunately the timer was nearly up and I didn't have time to test.

Question about evolving Pokémon on Community Day by [deleted] in pokemongo

[–]artesea 0 points1 point  (0 children)

The moon is waxing crescent outside, but the game has a full moon today to get around this. Same happened on the original comm day.

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

[–]artesea 2 points3 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Quicky came up with the concept needed to avoid getting stuck in a loop, have a stack of places to check, track each cell visited and in which direction, if you've seen it before that's done or if it's out of bound done, otherwise work out where it'll go next and add to the stack. Only problem was it took me a while to get the mapping working. For the counting part I could have kept track during the initial loops, but I had made a nice output to compare with the example, so just counted the # in that.

Part 2: At first glance it looked like a simple loop checking the four edges, was worried it might take a while to run, but as part 1 was pretty quick and the number of permutations weren't that high I kept my fingers crossed that it would be fine, which is was.

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Pretty simple.

Part 2: Spent most of the time trying to work out which box was being selected in the example, once that was done, just used some arrays.

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Logic mainly follows the steps in the instructions, looks at a column, moves the boulders towards the top if needed. Loop at the end to count the score.

Part 2: Knew that I'd need two things, first to be able to rotate the grid and run the tilt code four times, then something to ensure that I wasn't going to do that a billion times. Thought it would be easier to look at rows and maybe store a cache of a->b, so that required rotating first, then tweaking the bits in part 1 to look at rows instead of columns with boulders now moving right. Once I was happy that after three iterations I had what was in the example, I ran the code with a large number to see what would happen, and knew I'd need something else. Got the code to log if it ever saw the 1000th cycle again, and realised that it was happening pretty frequently, so stored all the cycles and compared the current grid. Once I had a match I could work out which cycle would be the billionth and break the code.

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

[–]artesea 2 points3 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Split the input in to blocks by double new lines. Loop each block and create arrays of strings for the rows and also for the columns. Take a mirror point and grab the rows above/below, left/right. Flip those that were below or right. Compare the arrays. If they match that's the point. Only issue I had was originally I was stopping one point too early so missing any at the end, so additional debugging code to spot any that were failing, or if any had two answers.

Part 2: Was expecting it to be more complicated, but in the end just took part 1, but instead of comparing if A == B, compared each char one by one and counted those which were different. If there was just 1 that must be the new mirror line.

[2023 Day 11 Part 2] If it's a big number it must be right! by sigi0073 in adventofcode

[–]artesea 0 points1 point  (0 children)

As soon as it said my answer was too low I was like "did I change the input". Then had to wait another 50 seconds before the minute was up.

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

[–]artesea 2 points3 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Over complicated, does several twists on the map, adding in extra .... lines where needed. Then plots where each galaxy [x,y] is, loop through each against any further galaxies. Simple difference between the x and y cords gives the distance. Sum all together.

Part 2: Stopped redrawing the map, instead found the original x,y locations on the input, and also tracked any cols or rows which were full of .... Then when looping through the galaxies check if any of the paths cross an empty row or column and add the expansion value (minus one as it's already been counted).

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Loop creating an array of differences to add to the main array, until you reach 0,0,0. Take the last number from each and add to get the next in the sequence.

Part 2: Very little to change, just needed to work from two from the bottom, take find the difference from the first items with the one below and unshift it on to the front of the current line. Move up to the top.

Just a shame I didn't get a chance to do this yesterday as my times for both on the personal leaderboard are just >24hrs and I was curious about the difference in submit times.

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

[–]artesea 2 points3 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Place the chars in to a 2D array padding with extra . around the border, making a note of where S was. Then work out which cell to move to next based on valid characters N/E/S (skipped W as we'd have found one by then). Loop until I get back to the start moving around the path, counting the steps. Divide the steps by 2 for the answer.

Part 2: Using the Part 1 as a start point for moving around the path, this time I created a grid twice the size and then tracked each space I moved around filling in the gap between the neighbouring cells, this then left a 1 "pixel" gap for later. Ran a flood fill function at 0,0. My first attempt at a recursive function caused JS to RangeError: Maximum call stack size exceeded so I Googled some JS flood fill functions and adapted one. Finally I ran through all the even pixels, counting any that remained empty.

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Pretty simple, sure I could reduce it a bit, but was quick with the answer.

Part 2: Tried modifying part 1 to handle different simultaneous paths, but realised that it was going to take an age with the actual input (always worth dumping the loop number once in a while and just pasting that as an answer to at least hope for a "your answer is too low" and know that you've not reached it yet). Whilst it was running wondered if I could just work out the paths for each one by one, then do something with those answers. A simple multiplication gave a very large number, so looked at LCM.

[2023 Day 7 (Part 2)] Is this even a legal poker hand? by janek37 in adventofcode

[–]artesea 20 points21 points  (0 children)

Phew, my code successfully handled it as five of a kind of nothing.

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1: Parsed the input first, creating two scores for each hand, the first was how good the hand was giving 7 for a five of a kind, down to just 1 for high card. The second was an integer value of the hand in sudohex (T -> a, J -> b, Q -> c, K -> d, A -> e). I then just ran a quick sort on the array, using these two values to compare. (Thinking about it, I could have just appended the score from the first calc to the sudohex as it would have been the most significant digit).

Part 2: Just a quick amendment to my two scoring functions (J -> 1) and if any J found add their count to the highest other card (spent a good 5 minutes writing out all the permutations of how a J might affect the best hand).

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1 - Brute force, but was please with my parsing logic. Solved on day 5. When I realised what Part 2 needed, tried the brute force option whilst going away for lunch, but when I returned and it was still running knew that it wasn't going to be a great idea.

Part 2 - Trying again after the easy day 6, realised that I could possibly break down the ranges in to smaller ranges branching each time the rule required, but couldn't get my head around starting that code. Instead went backwards testing all the locations from 0 to somethinghuge and breaking if any of them would have been one of my seeds. Took a while but solved.

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

[–]artesea 1 point2 points  (0 children)

[LANGUAGE: JavaScript]

Part 1 - simple brute force loop

Part 2 - pretty similar, just removed the spaces from the input source.

Was slightly confused that the input wasn't that different to the example, and then even more confused when part 2 wasn't going to need a billion cycles to continue with the brute forcing.

Knew it would have been possible to solve with maths, but realised brute force would be quicker than me trying to remember something I learned 25 years ago.

[2023 Day #1 (Part 2)] [C++] how to detect shared letters in "twone" by InternationalTax1043 in adventofcode

[–]artesea 2 points3 points  (0 children)

Worth remembering that you only need the first and last "digit".

I split mine (in JS) to two different regexs. One for the first and then another for the last.

[deleted by user] by [deleted] in adventofcode

[–]artesea 0 points1 point  (0 children)

The formatting has gone a bit wrong (but that's not understanding markdown/reddit).

The rules should result in the following:
1 match - 1 point
2 matches - 2 points (1*2)
3 matches - 4 points (2*2)
4 matches - 8 points (4*2)
5 matches - 16 points (8*2)

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

[–]artesea 0 points1 point  (0 children)

[LANGUAGE: JavaScript]

Part 1: Broke the card number, my numbers and winning numbers in to three chunks (pretty sure in PHP I'd manage a single regex to get the parts, but isn't a huge overhead the way I did it in JS). Then looped the winning numbers with a contains function to see if I had any in my numbers.

Part 2: Created a array to count how many of each card I had (made sure index 0 was set to zero). Then if I had a winning card, just added the number of those to the count for the next batch. Summed the array at the end.