Author Topic: Advent of Code  (Read 111643 times)

Re: Advent of Code
« Reply #725 on: 21 December, 2018, 03:02:13 pm »
Still stuck on day 17, havent' tried any subsequent ones - have had to go out to the shops for new jelly and nails as I keep running out, and start again in a new room with a fresh ceiling.

Ooh. What's the problem? Wrong answer, not fast enough or just can't get it to work properly at all?

I had a bug in mine where it wouldn't accept my answer for part (b), when I eventually fixed it I got the right answer for part (b) but the answer it gave for part (a) changed as well but my original (now incorrect) answer for part (a) was accepted.
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: Advent of Code
« Reply #726 on: 21 December, 2018, 08:07:53 pm »
Still stuck on day 17, havent' tried any subsequent ones - have had to go out to the shops for new jelly and nails as I keep running out, and start again in a new room with a fresh ceiling.

Ooh. What's the problem? Wrong answer, not fast enough or just can't get it to work properly at all?

I had a bug in mine where it wouldn't accept my answer for part (b), when I eventually fixed it I got the right answer for part (b) but the answer it gave for part (a) changed as well but my original (now incorrect) answer for part (a) was accepted.

I've come up with an answer but it doesn't accept it at all.
I have produced a pretty picture of what it looks like: https://1drv.ms/u/s!AtNSfl0sxZVlgZIQQ8xv9FsIru8Jww

I have got a loop which I can't figure out how to exit, but at the point where it is not finding any new tiles the situation is as the picture above (should open in paint or simple bmp editor), and it gets to that situation in under a second.
I guessed
(click to show/hide)


Re: Advent of Code
« Reply #727 on: 21 December, 2018, 08:25:11 pm »
FWIW, my program agrees with yours for your input. I get the same answer and I can't see anything wrong in the output.

My previous version the program also gives the same answer (even though it exhibits a bug with my input).

I'd move on.
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: Advent of Code
« Reply #728 on: 21 December, 2018, 08:35:12 pm »
FWIW, my program agrees with yours for your input. I get the same answer and I can't see anything wrong in the output.

My previous version the program also gives the same answer (even though it exhibits a bug with my input).

I'd move on.

Groan............... found it,
(click to show/hide)

Ben T

Re: Advent of Code
« Reply #729 on: 21 December, 2018, 08:40:17 pm »
Ah - part 2 was easy for my algorithm.
(click to show/hide)

Re: Advent of Code
« Reply #730 on: 21 December, 2018, 08:49:26 pm »
Groan............... found it,
(click to show/hide)

(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #731 on: 22 December, 2018, 11:10:25 am »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #732 on: 23 December, 2018, 11:04:15 am »
Ooh, day 23 part b looks like a stinker, have ideas and not going to look anywhere for hints. Might take a while!

[EDIT] Got the answer for part b but not satisfied with my method at all. It doesn't work at all on the simple example given in the problem.

Some details in this spoiler.

(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: Advent of Code
« Reply #733 on: 23 December, 2018, 06:55:44 pm »
Quite enjoyed day 19.
(click to show/hide)

Ben T

Re: Advent of Code
« Reply #734 on: 23 December, 2018, 08:34:17 pm »
(click to show/hide)
(click to show/hide)

Ben T

Re: Advent of Code
« Reply #735 on: 24 December, 2018, 03:27:03 pm »
Done day 21... dog alone knows what the algorithm is trying to do, unlike 19 that there actually seems to be a point to it.
(click to show/hide)

Re: Advent of Code
« Reply #736 on: 24 December, 2018, 07:47:23 pm »
Ooh, day 23 part b looks like a stinker, have ideas and not going to look anywhere for hints. Might take a while!
[EDIT] Got the answer for part b but not satisfied with my method at all. It doesn't work at all on the simple example given in the problem.
My method was something similar but opposite results - it worked for the example but unfortunately not the real data  :(
Quote from: tiermat
that's not science, it's semantics.

Ben T

Re: Advent of Code
« Reply #737 on: 25 December, 2018, 07:24:28 pm »
Ooh, day 23 part b looks like a stinker, have ideas and not going to look anywhere for hints. Might take a while!

[EDIT] Got the answer for part b but not satisfied with my method at all. It doesn't work at all on the simple example given in the problem.

Some details in this spoiler.

(click to show/hide)

To be honest I had absolutely no idea.
However if you read this (contains spoiler), the methodology makes perfect sense and from the description of the method, I was able to code it in C++ purely from my understanding of the method, and without looking at his algorithm. But I've got to admit, I'm not sure I would have come up with that idea on my own.
(click to show/hide)

Re: Advent of Code
« Reply #738 on: 26 December, 2018, 11:31:19 am »
Ooh, day 23 part b looks like a stinker, have ideas and not going to look anywhere for hints. Might take a while!
[EDIT] Got the answer for part b but not satisfied with my method at all. It doesn't work at all on the simple example given in the problem.
My method was something similar but opposite results - it worked for the example but unfortunately not the real data  :(
Finally got it.

(click to show/hide)
Quote from: tiermat
that's not science, it's semantics.

Re: Advent of Code
« Reply #739 on: 27 December, 2018, 11:53:38 am »
Finished now (didn't get a chance to do more than a few minutes during the last 3 days).

Wasted a bit of time with a misreading of the 24th but got it in 10 minutes this morning and part 2 followed on simply. Not a big fan of big wordy plods like this, but they're quite representative of real world coding with slightly imprecise specs and long slogs of boring programming!
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: Advent of Code
« Reply #740 on: 27 December, 2018, 05:08:35 pm »
Finished now (didn't get a chance to do more than a few minutes during the last 3 days).

Wasted a bit of time with a misreading of the 24th but got it in 10 minutes this morning and part 2 followed on simply. Not a big fan of big wordy plods like this, but they're quite representative of real world coding with slightly imprecise specs and long slogs of boring programming!

 :-\ :-\ Not sure where you work - but can I have a job there?!

Whilst I think it's nice that AoC has presented a dimension of difficulty in terms of having a verbose, complicated spec - I would disagree that they're representative - I would say that AoC specs are far, far better written and more concise than real world specs.
 :)

e.g. AoC
Spec: "During the target selection phase, each group attempts to choose one target. In decreasing order of effective power, groups choose their targets; in a tie, the group with the higher initiative chooses first. The attacking group chooses to target the group in the enemy army to which it would deal the most damage (after accounting for weaknesses and immunities, but not accounting for whether the defending group has enough units to actually receive all of that damage)."

Real world would be:
Spec: "The strongest [sic] attack first."
Dev: " 'Strongest' meaning? The one with the most power, or the most units?"
Sponsor: "Oh, er... the one with the most power."
Dev: "Ok."
Later:
Sponsor: "This is a BUG! Unit C has attacked before unit D!"
Dev: "Yes, well, they've both got the same power. As designed."
Sponsor: "Yes but D has got higher initiative!"
Dev: "You didn't say anything about higher initiative attacking first in the event of a tie."
Sponsor: "Well, that should have been obvious!"

Recent AoC problems like Day 24 test the skill of data modelling, as well as just procedural logic.

I don't think any of the specs have been ambiguous. Some have been confusing, particularly Day 17, which required reading every single bit of it very very carefully, with crucial detail being in the letter rather than the spirit of the rules, but I don't think any have actually required a leap of faith or reading between the lines, or been noticeably ambiguous.

Clarifications like 'not accounting for whether the defending group has enough units to actually receive all of that damage' are the exact sort of things that are missing from real world specs as it is the sort of thing only a developer would think about.
In reality, if you were programming a real army, some devs might decide that the sponsor wouldn't want to see a powerful unit "waste" an attack on one that is already nearly dead, and insert that into the logic, even though the sponsor didn't specify that - but other devs might not. Here, he's thought about it from the programmer's point of view and clarified it.

Ben T

Re: Advent of Code
« Reply #741 on: 27 December, 2018, 11:44:40 pm »
What was a bit sneaky though was
(click to show/hide)

SoreTween

  • Most of me survived the Pennine Bridleway.
Re: Advent of Code
« Reply #742 on: 06 January, 2019, 10:39:20 am »
(click to show/hide)

It's not the answer but it will lead you in the right direction, up to you whether you read it obviously.
(click to show/hide)
2023 targets: Survive. Maybe.
There is only one infinite resource in this universe; human stupidity.

Re: Advent of Code
« Reply #743 on: 08 January, 2019, 11:32:22 am »
"271 people have gotten all 200 stars over the four years of #AdventOfCode."

https://twitter.com/ericwastl/status/1082420178510667781

:smug:
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #744 on: 22 November, 2019, 09:04:53 am »
9 days to go until #AdventOfCode 2019

(Already donated so I have my AOC++ badge for 2019).
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #745 on: 01 December, 2019, 09:42:50 am »
Day 1 2019.

Didn't read part b properly (as usual) and made the expected mistake, easily fixed though.

Find the first few days a bit underwhelming after the anticipation, looking forward to a nice meaty problem.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #746 on: 02 December, 2019, 09:26:17 am »
Day 2 2019 (no need for spoiler tags yet).

"Good, the new computer seems to be working correctly! Keep it nearby during this mission - you'll probably use it again. Real Intcode computers support many more features than your new one, but we'll let you know what they are as you need them."

I guess this is going to be one of the themes for this year. I'll spend a bit of time making sure it's nicely cleaned up and ready for inclusion in the aoc/2019 directory rather than buried in a specific day's directory.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #747 on: 03 December, 2019, 10:50:40 am »
Day 3 2019 (no spoiler tags required)

Today's small delay was caused by a typo in some regex. I initially had /^U(\d)+$/ instead of /^U(\d+)$/ when extracting the number of steps on each instruction (and copy-pasta'd for the other directions). Thankfully the basic test cases provided made it very easy to spot that there was a problem.
"Yes please" said Squirrel "biscuits are our favourite things."

vorsprung

  • Opposites Attract
    • Audaxing
Re: Advent of Code
« Reply #748 on: 03 December, 2019, 05:27:53 pm »
ICBA this year.  I am interviewing at the moment and have various "tech tasks" to do of random IT puzzles

"no, we don't mind what skills you have.  We are looking for a good attitude and general grasp.  Here's the tech task, should take 4-5 hours"  Yeah right 4-5 hours if I had EXACTLY the same experience as your inhouse staff :(

Re: Advent of Code
« Reply #749 on: 03 December, 2019, 06:32:07 pm »
This year I'm doing them in C# instead of Perl. The gains from a nice test framework and intellisense are more than cancelled out by the sheer wordiness of it all.

Delay today caused by trying to dump all the points into Lists and do a Linq intersect to pop out all the crossings. Great for the tests, way too slow for the full puzzle - didn't expect to get hit by that on day 3. So had to go back and do it again properly. 174 lines of code + tests, would probably have been about ten in Perl.
Quote from: tiermat
that's not science, it's semantics.