Author Topic: Advent of Code  (Read 109978 times)

Re: Advent of Code
« Reply #600 on: 23 December, 2017, 11:53:14 am »
Neat  ;)
Quote from: tiermat
that's not science, it's semantics.

Re: Advent of Code
« Reply #601 on: 23 December, 2017, 12:39:10 pm »
Day 23 part 2
(click to show/hide)
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Advent of Code
« Reply #602 on: 23 December, 2017, 01:28:59 pm »
Thankfully I chose wisely at the start of today's challenge.

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

Ben T

Re: Advent of Code
« Reply #603 on: 23 December, 2017, 03:35:40 pm »
(click to show/hide)

Re: Advent of Code
« Reply #604 on: 23 December, 2017, 03:47:41 pm »
With my numbers, the first time f was not 0 was at row 38 in a table similar to yours.

Quote from: tiermat
that's not science, it's semantics.

Re: Advent of Code
« Reply #605 on: 23 December, 2017, 03:51:35 pm »
I've not done 21, so now my circuit shows the connections for 22 & 23 but won't light up.  :-[
Quote from: tiermat
that's not science, it's semantics.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #606 on: 23 December, 2017, 05:06:37 pm »
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #607 on: 23 December, 2017, 05:28:03 pm »
The different patterns in the circuit are getting more creative. Just had a chip labelled 1.21GW - must be a flux capacitor.
"By creating we think. By living we learn" - Patrick Geddes

Ben T

Re: Advent of Code
« Reply #608 on: 23 December, 2017, 07:04:12 pm »
(click to show/hide)


(click to show/hide)

Ben T

Re: Advent of Code
« Reply #609 on: 23 December, 2017, 07:18:11 pm »
(click to show/hide)


(click to show/hide)


(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #610 on: 23 December, 2017, 08:06:12 pm »
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #611 on: 24 December, 2017, 08:59:05 am »
(click to show/hide)

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

Re: Advent of Code
« Reply #612 on: 24 December, 2017, 09:06:46 am »
Day 24 a bit more interesting, but not complicated.

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

Re: Advent of Code
« Reply #613 on: 24 December, 2017, 09:32:05 am »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #614 on: 24 December, 2017, 12:27:01 pm »
Day 24
(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #615 on: 24 December, 2017, 01:42:21 pm »
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #616 on: 25 December, 2017, 09:58:54 pm »
(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 #617 on: 25 December, 2017, 10:09:47 pm »
(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 #618 on: 27 December, 2017, 09:47:40 am »
Day 24.

Well that took me far too long, but it taught me quite a lot about what takes time in a program.

I wrote a routine that worked out strengths of possible bridges made out of components, and when it comes to more than one that fits, another possible bridge is created, to be looked at later. I had sorted the components so that they could be indexed by number of pins, so finding the next available connector was quick.

Stupidly, I got the programme to look for the first unfinished possible bridge each time a component was added to a possible bridge. It was that looking that took most of the time, being a loop within a loop. As the number of bridges got large, that got too large to manage, while with small numbers of bridges it wasn't a problem. I didn't realise the cause initially.

I looked at the data to optimise it, and saw that there were various unusable components, some components that would always be worse than others, and many combinations that could only usefully fit together one way. I used that to create a reduced data input set, but one with an extra column for the "strength" of the missed connectors. For instance, if I found that the only connectors with 33 pins were 1/33 and 2/33, I would create a new component that was 1/2 but had an extra 66 of strength to be added when used.

With that, I got the answer, but the code took a minute or more to run.

Then I saw that everyone else had code that ran in seconds or less, and I realised that my loop within a loop was the problem. I sorted that, and worked out the statistics.

The full data ran added 1.8 million components, and tried 600,000 possible bridges
The reduced data added 66,000 components and tried 31,000 possible bridges.

The reduced data, when the code was searching for unfinished bridges, did 485 million loops just looking for the next bridge to try.


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

Re: Advent of Code
« Reply #619 on: 18 March, 2018, 11:05:32 pm »
Decided to learn go so redoing 2017 in go.

https://github.com/alexgreenbank/AdventOfCode

It's certainly easier when you know how to solve each one efficiently (or at least efficiently enough).

Day 5 and I finally got to the point where I wrote the complete program for part one and only had to correct typos after the first attempt at running it.
"Yes please" said Squirrel "biscuits are our favourite things."

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #620 on: 18 March, 2018, 11:46:30 pm »
Really not got the time till after the Easter break. Love to get back into it, but that will have to wait till the summer.
"By creating we think. By living we learn" - Patrick Geddes

Ben T

Re: Advent of Code
« Reply #621 on: 19 March, 2018, 06:33:20 am »
Decided to learn go so redoing 2017 in go.

https://github.com/alexgreenbank/AdventOfCode

It's certainly easier when you know how to solve each one efficiently (or at least efficiently enough).

Day 5 and I finally got to the point where I wrote the complete program for part one and only had to correct typos after the first attempt at running it.
If you want more practice try some project euler problems, AoC is easy in comparison (mostly).  :P

Re: Advent of Code
« Reply #622 on: 19 March, 2018, 12:27:35 pm »
If you want more practice try some project euler problems, AoC is easy in comparison (mostly).  :P

Yep, and the UVA (https://uva.onlinejudge.org/). The limiting factor in all of this is free time.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: Advent of Code
« Reply #623 on: 30 November, 2018, 06:59:30 am »
Anyone getting up early tomorrow morning?

Re: Advent of Code
« Reply #624 on: 30 November, 2018, 12:03:52 pm »
I'll never get up early to do it, it has to fit into my day somehow. I won't get around to Sunday's until late in the evening (and I'll probably still be hungover).

I'll probably do mine first time in perl or C and then reimplement in Go. Have been meaning to look at Rust too.
"Yes please" said Squirrel "biscuits are our favourite things."