Author Topic: Advent of Code  (Read 113916 times)

Re: Advent of Code
« Reply #450 on: 09 December, 2017, 01:08:39 am »
Hoping to sober up enough to be able to do Day 9 tomorrow today.

Hic.

I foresee much keyboard thrashing and grumpiness...
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: Advent of Code
« Reply #451 on: 09 December, 2017, 10:16:07 am »
nothing taxing as long as you don't try and be too fancy.

Re: Advent of Code
« Reply #452 on: 09 December, 2017, 11:06:57 am »
I've written enough stuff that parses input (specifically SQL and CSV) to understand the joy of string parsing with escape characters. Even with a slightly foggy brain from a mild hangover.

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

Manotea

  • Where there is doubt...
Re: Advent of Code
« Reply #453 on: 09 December, 2017, 11:42:40 am »
Inspired by Greenbank, I started reading this

Then realised I had something else to do today.  :)

Ben T

Re: Advent of Code
« Reply #454 on: 09 December, 2017, 01:54:14 pm »
I've written enough stuff that parses input (specifically SQL and CSV) to understand the joy of string parsing with escape characters. Even with a slightly foggy brain from a mild hangover.

(click to show/hide)

I'm reasonably au fait with regex but wouldn't attempt to use it to try and count group nesting.... I didn't see any need for recursion but whether it could have made it more elegant I don't know. Mine's a fairly simple literal interpretation of the logic as described https://github.com/bjtaylor1/AoC2017/blob/day09part2/Day09/Program.cs
nothing wrong with recursion if you just like it though :)

Re: Advent of Code
« Reply #455 on: 09 December, 2017, 03:23:24 pm »
...then a second one to parse the garbage free input into the groups, then a recursive function to score it all.
The input was well-formed enough that it only required counting the { up and } down

Quote
I'm secretly hoping that someone attempts this with a regex and eventually learns the lesson about regular expressions and context-free grammars.

This particular one would be fairly straightforward with a regex, but yes it's the perennial question "how do I parse **ML with a regex?" A: DON'T!!

For a laugh I solved this using regular expressions, it took rather longer to code than doing it with a pencil but the result was quite impressive nonetheless.
Quote from: tiermat
that's not science, it's semantics.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #456 on: 09 December, 2017, 04:02:32 pm »
Just plough through and process it as a stream.

(click to show/hide)

I did come across an interesting puzzle that was easily solved to a certain state with matrix algebra. I then have to sort a matrix to get the minimum diagonal to get the appropriate order of rows.
"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 #457 on: 09 December, 2017, 04:49:26 pm »
Just plough through and process it as a stream.

(click to show/hide)

I did come across an interesting puzzle that was easily solved to a certain state with matrix algebra. I then have to sort a matrix to get the minimum diagonal to get the appropriate order of rows.

I don't think you pushed your day 9 changes to github yet ;)

(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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #458 on: 09 December, 2017, 07:14:02 pm »
Good spot. Didn't tick the 'push to origin automatically' box in Sourcetree.
"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 #459 on: 09 December, 2017, 08:40:38 pm »
(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 #460 on: 10 December, 2017, 06:27:17 am »
The instructions for day 10 almost lead you though the programming steps needed. It reads more like a lesson in computing than a puzzle.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #461 on: 10 December, 2017, 08:59:01 am »
Agreed. Involved but not hard. Bleary eyed typos notwithstanding. Not sure I have the oomph in the morning to test-suite it. I'd have sorted the tests after finding the things that needed to be tested, by which time they would be unnecessary.
"By creating we think. By living we learn" - Patrick Geddes

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #462 on: 11 December, 2017, 07:20:21 am »
Ouch - my head hurts a bit after trying to sort that one out. Probably an inelegant solution to calculate the total number of steps. I'm sure there must be a better way to resolve the axes than a series of if/else looking at the relevant cases. Possibly something matrixy but my brain isn't functioning.
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #463 on: 11 December, 2017, 07:37:02 am »
Day 11

(click to show/hide)

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

Re: Advent of Code
« Reply #465 on: 11 December, 2017, 10:41:34 am »
Day 11

(click to show/hide)

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #466 on: 11 December, 2017, 11:15:05 am »
(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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #467 on: 11 December, 2017, 12:25:55 pm »
Day 11

(click to show/hide)
I must admit that trying to sort that at early morning after dealing with a frozen pipe leading to a major water leak in the house was challenging enough - I thought it should be able to be done something like that. Instead I did it the hard way.
"By creating we think. By living we learn" - Patrick Geddes

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #468 on: 11 December, 2017, 12:59:04 pm »
Day 11

(click to show/hide)

I am struggling to see how you come up with that matrix.

"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #469 on: 11 December, 2017, 01:45:59 pm »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #470 on: 11 December, 2017, 01:47:29 pm »
Greenbank beat me to it, but..
(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #471 on: 11 December, 2017, 03:33:59 pm »
Doh! I was looking at steps but not in the right directions.
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #472 on: 11 December, 2017, 08:22:17 pm »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #473 on: 12 December, 2017, 07:45:31 am »
Underwhelming today...

Jo's graphs seem to back up my suspicion that 2017 (so far at least) is quite a bit easier than the previous years: https://github.com/jwoLondon/adventOfCode
"Yes please" said Squirrel "biscuits are our favourite things."

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #474 on: 12 December, 2017, 08:22:59 am »
(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