Author Topic: Advent of Code  (Read 30474 times)

Re: Advent of Code
« Reply #725 on: December 21, 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

  • What you saying, then?
Re: Advent of Code
« Reply #726 on: December 21, 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)

Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Re: Advent of Code
« Reply #727 on: December 21, 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

  • What you saying, then?
Re: Advent of Code
« Reply #728 on: December 21, 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)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Ben T

  • What you saying, then?
Re: Advent of Code
« Reply #729 on: December 21, 2018, 08:40:17 pm »
Ah - part 2 was easy for my algorithm.
(click to show/hide)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Re: Advent of Code
« Reply #730 on: December 21, 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: December 22, 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: December 23, 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

  • What you saying, then?
Re: Advent of Code
« Reply #733 on: December 23, 2018, 06:55:44 pm »
Quite enjoyed day 19.
(click to show/hide)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Ben T

  • What you saying, then?
Re: Advent of Code
« Reply #734 on: December 23, 2018, 08:34:17 pm »
(click to show/hide)
(click to show/hide)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Ben T

  • What you saying, then?
Re: Advent of Code
« Reply #735 on: December 24, 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)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Re: Advent of Code
« Reply #736 on: December 24, 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

  • What you saying, then?
Re: Advent of Code
« Reply #737 on: December 25, 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)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Re: Advent of Code
« Reply #738 on: December 26, 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: December 27, 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

  • What you saying, then?
Re: Advent of Code
« Reply #740 on: December 27, 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.
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

Ben T

  • What you saying, then?
Re: Advent of Code
« Reply #741 on: December 27, 2018, 11:44:40 pm »
What was a bit sneaky though was
(click to show/hide)
Unless you put on overalls, boots, and a helmet with a high tech pre fitted lamp - and you dig coal - nope, you don't know me.

SoreTween

  • Most of me survived the Pennine Bridleway.
Re: Advent of Code
« Reply #742 on: January 06, 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)
2018 targets: Survive
There is only one infinite resource in this universe; human stupidity.

Re: Advent of Code
« Reply #743 on: January 08, 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."