Author Topic: Advent of Code  (Read 112530 times)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #275 on: 14 December, 2016, 09:17:11 am »
For Diver300:
(click to show/hide)

For Jo:
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #276 on: 14 December, 2016, 09:31:03 am »

(click to show/hide)

I did that one too.

(click to show/hide)
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

Ben T

Re: Advent of Code
« Reply #277 on: 14 December, 2016, 09:49:08 am »
Day 14....
Hint:
(click to show/hide)

(click to show/hide)

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #278 on: 14 December, 2016, 10:05:47 am »
Day 14....
Hint:
(click to show/hide)

(click to show/hide)

(click to show/hide)
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

red marley

Re: Advent of Code
« Reply #279 on: 14 December, 2016, 11:27:33 am »
Day 14 continued...

(click to show/hide)

Re: Advent of Code
« Reply #280 on: 14 December, 2016, 03:44:26 pm »
Day 14

(click to show/hide)
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #281 on: 14 December, 2016, 04:03:15 pm »
Day 14

(click to show/hide)

(click to show/hide)
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

Re: Advent of Code
« Reply #282 on: 14 December, 2016, 04:32:31 pm »
Managed day 12 with only pencil and paper.  ;D
I've just belatedly solved day 11 similarly.
(click to show/hide)
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #283 on: 14 December, 2016, 04:33:57 pm »
Mine sounds very much like Oaky's using a dict of arrays to store candidate indices which can then be reviewed if pentuples are found.
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #284 on: 14 December, 2016, 05:04:32 pm »
Managed day 12 with only pencil and paper.  ;D
I've just belatedly solved day 11 similarly.

It's an interesting question - I have some sympathy for Oaky's point of view above.  Any question where the input is quite small is potentially vulnerable to a more pure mathematical approach.  Particularly something like day 11 where the answer is relatively small and you get more than one attempt.

In this case, I'd argue you've crossed that fine line to guessing.  But since I am myself putting the first answer produced by code into the box and only going back to check for bugs if it fails (and suspect I am not alone in this), I'm not sure how clear-cut the "guessing is cheating" argument is.

Also, note.

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #285 on: 14 December, 2016, 06:01:23 pm »
Managed day 12 with only pencil and paper.  ;D
I've just belatedly solved day 11 similarly.
(click to show/hide)

(click to show/hide)
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

Re: Advent of Code
« Reply #286 on: 14 December, 2016, 06:13:20 pm »
Managed day 12 with only pencil and paper.  ;D
I've just belatedly solved day 11 similarly.
(click to show/hide)

(click to show/hide)

I agree.

I am not arguing that my solution is in any way robust. The example that you give is intentionally awkward, and I think that the puzzle always starts with the elevator on the ground floor, and it has to be soluble, so I don't think that real puzzles can be quite as awkward as yours, but I am sure there are some that have to start with less efficient moves.

I suspect that once the initial awkwardness is sorted, the  bulk of a solution is perfectly efficient, but I haven't proved it.

We shall see if later puzzles leave me lost due to my lack of rigor in day 11
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #287 on: 14 December, 2016, 06:38:53 pm »
Managed day 12 with only pencil and paper.  ;D
I've just belatedly solved day 11 similarly.
(click to show/hide)

(click to show/hide)

I agree.

I am not arguing that my solution is in any way robust. The example that you give is intentionally awkward, and I think that the puzzle always starts with the elevator on the ground floor, and it has to be soluble, so I don't think that real puzzles can be quite as awkward as yours, but I am sure there are some that have to start with less efficient moves.

I suspect that once the initial awkwardness is sorted, the  bulk of a solution is perfectly efficient, but I haven't proved it.

We shall see if later puzzles leave me lost due to my lack of rigor in day 11

 ;D

BTW - I gather that the position I quoted (from p_tseng's reddit post), is a subset of a position that occurs during the optimal solution of an actual input that somebody was given.

You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

red marley

Re: Advent of Code
« Reply #288 on: 14 December, 2016, 11:25:15 pm »
Day 14 speed of calculation.

Given the various ways of finding a solution seemed to result in quite different times taken to calculate, I thought I'd have a look at where the bottleneck was when using Java.
(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #289 on: 15 December, 2016, 07:43:07 am »
(click to show/hide)

Day 15:
Straightforward.
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

red marley

Re: Advent of Code
« Reply #290 on: 15 December, 2016, 08:02:48 am »
Why do you need to convert to lower case? It isn't material to the problem.

Because...

(click to show/hide)

Re: Advent of Code
« Reply #291 on: 15 December, 2016, 09:02:38 am »
Day 15:
Straightforward.
(click to show/hide)
(click to show/hide)
As is often the case, part 1 could be solved by brute force, but the seemingly small addition of part 2 made brute force impractical so thinking was needed. My first solution to part 2 depended on the brute force solution to part 1, which made me realise that a far faster and more elegant solution was possible to part 1.

Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #292 on: 15 December, 2016, 09:31:39 am »
Smartish brute force.. in my case, though it should be possible to describe the equation analytically.
"By creating we think. By living we learn" - Patrick Geddes

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #293 on: 15 December, 2016, 09:42:58 am »
Dumb brute force for both parts (Python 2).

Part 1 runs in ~0.6 sec and Part 2 in ~2.1 sec.

I had a feeling when I set it away using the same brute force that part 2 was going to take too long that way and that I'd have to go back and recode it to be smarter, and was surprised when that wasn't the case.

I did go back and apply a couple of optimisations to my discStack class:-

(click to show/hide)
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

Ben T

Re: Advent of Code
« Reply #294 on: 15 December, 2016, 09:56:17 am »
Day 15 really easy. No optimizations even remotely necessary. Both parts run instantaneously
(click to show/hide)

Ben T

Re: Advent of Code
« Reply #295 on: 15 December, 2016, 10:48:44 am »
Day 15 one liner
(click to show/hide)

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #296 on: 15 December, 2016, 11:29:21 pm »
After day 15's relatively easy problem, what's the betting day 16 is going to be a stinker?
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #297 on: 16 December, 2016, 05:48:51 am »
After day 15's relatively easy problem, what's the betting day 16 is going to be a stinker?

Apparently not.

(click to show/hide)

What am I going to do with the rest of my morning?  Might have to do some work! ;D
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

red marley

Re: Advent of Code
« Reply #298 on: 16 December, 2016, 06:14:26 am »
I didn't really dig today's (Day 16). Just grinding though some standard string manipulation, which is more or less tedious depending on your language of choice.

Yesterday's was more interesting because of there was plenty of scope for optimisation and was good practice for taking a functional approach (and unlike Day 11, could be done before breakfast).

Re: Advent of Code
« Reply #299 on: 16 December, 2016, 06:17:09 am »
After day 15's relatively easy problem, what's the betting day 16 is going to be a stinker?

Apparently not.

(click to show/hide)

What am I going to do with the rest of my morning?  Might have to do some work! ;D
(click to show/hide)
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...