Author Topic: Advent of Code  (Read 112494 times)

Ben T

Re: Advent of Code
« Reply #525 on: 17 December, 2017, 03:13:28 pm »
17a was quite straightforward.
17b required minor thought but eventually succumbed to brute force
(click to show/hide)

(click to show/hide)

(click to show/hide)

Re: Advent of Code
« Reply #526 on: 17 December, 2017, 03:33:35 pm »
Ben T:
(click to show/hide)

Ben T

Re: Advent of Code
« Reply #527 on: 17 December, 2017, 05:08:27 pm »
Ben T:
(click to show/hide)

(click to show/hide)

Re: Advent of Code
« Reply #528 on: 17 December, 2017, 06:27:35 pm »
Don't you need to increment buf_len?
Yes.

I put that after the conditional bit for some reason.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

Re: Advent of Code
« Reply #529 on: 17 December, 2017, 07:14:23 pm »
Ben T:
(click to show/hide)

Re: Advent of Code
« Reply #530 on: 18 December, 2017, 09:25:38 am »
Day 18.

Part a: Yet another psuedo CPU question. Boooring, or so I thought.

But part b was a lovely twist on it.

(00:15:45 from start to part a solution, 00:35:14 from start to part b solution, would have been a minute quicker if I'd read which answer I needed to give more closely.)

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

Re: Advent of Code
« Reply #531 on: 18 December, 2017, 09:29:48 am »
64 characters for part 2, including input data.  ;D

I can get it down to 84 in perl, but then I'm not very good at code golf.

I look forward to comparing line noise tomorrow!

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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #532 on: 18 December, 2017, 01:11:16 pm »
First read the instructions..

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

Re: Advent of Code
« Reply #533 on: 18 December, 2017, 01:21:15 pm »
64 characters for part 2, including input data.  ;D

I can get it down to 84 in perl, but then I'm not very good at code golf.

I look forward to comparing line noise tomorrow!

(click to show/hide)

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

Re: Advent of Code
« Reply #534 on: 18 December, 2017, 06:05:00 pm »
First read the instructions..

(click to show/hide)

Should that be Day 18 ?

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Advent of Code
« Reply #535 on: 18 December, 2017, 09:58:13 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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #536 on: 18 December, 2017, 10:32:19 pm »
First read the instructions..

(click to show/hide)

Should that be Day 18 ?

That was probably one of the bugs..
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #537 on: 19 December, 2017, 08:12:59 am »
Not much of a workout today. (Day 19). And scarily I wrote a 97 line perl program that ran first time with no syntax errors (but one minor logic error that my checking caught).

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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #538 on: 19 December, 2017, 08:39:53 am »
Again, a lot of code for not much intellectual input - overengineered it but that isn't a bad thing.

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

Re: Advent of Code
« Reply #539 on: 19 December, 2017, 08:50:38 am »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #540 on: 19 December, 2017, 11:59:55 am »
Fortunately the input was well behaved, I had considered cases like two corners in consecutive steps, realised that the coding would be more involved and if it came across a not immediately tractable solution to print the local environment and ask for guidance. It didn't need to as there was at least one step between each corner.
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #541 on: 19 December, 2017, 12:14:50 pm »
A bit disappointed in the simplicity of Part 1. I was almost certain when doing part 1, that the second part was going to ask for the shortest path from start to destination point of part 1.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #542 on: 19 December, 2017, 12:21:50 pm »
By only taking known routes and adding corners where they cross.. I'm just expecting a humdinger tomorrow then.
"By creating we think. By living we learn" - Patrick Geddes

Re: Advent of Code
« Reply #543 on: 19 December, 2017, 12:33:40 pm »
Tripped up by having my packet fall off the end of the route and carry on going. The test data was fine as that took it off the circuit board and stopped, but on the actual circuit it found another path and carried on in circles. Oops.
Quote from: tiermat
that's not science, it's semantics.

Re: Advent of Code
« Reply #544 on: 19 December, 2017, 01:05:05 pm »
Fortunately the input was well behaved, I had considered cases like two corners in consecutive steps, realised that the coding would be more involved and if it came across a not immediately tractable solution to print the local environment and ask for guidance. It didn't need to as there was at least one step between each corner.

Not sure why this would be a problem, there are no decisions to be made at any corners. Either you can continue on in a straight line still or you have to choose left or right (and there won't be a choice).

For example:-

Code: [Select]
  |
B++A
  ++

is unambiguous.

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

Ben T

Re: Advent of Code
« Reply #545 on: 19 December, 2017, 01:55:07 pm »

(click to show/hide)

(click to show/hide)

Re: Advent of Code
« Reply #546 on: 19 December, 2017, 03:45:47 pm »

(click to show/hide)

(click to show/hide)

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

Ben T

Re: Advent of Code
« Reply #547 on: 19 December, 2017, 04:19:59 pm »

(click to show/hide)

(click to show/hide)

(click to show/hide)

(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #548 on: 19 December, 2017, 04:21:26 pm »
Fortunately the input was well behaved, I had considered cases like two corners in consecutive steps, realised that the coding would be more involved and if it came across a not immediately tractable solution to print the local environment and ask for guidance. It didn't need to as there was at least one step between each corner.

Not sure why this would be a problem, there are no decisions to be made at any corners. Either you can continue on in a straight line still or you have to choose left or right (and there won't be a choice).

For example:-

Code: [Select]
  |
B++A
  ++

is unambiguous.

but
Code: [Select]
   ||||
   ++++
isn't unless you look further afield than immediately adjacent characters. I couldn't be bothered so just wrote a prompt in to look at it by eye and indicate where it should go

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

Re: Advent of Code
« Reply #549 on: 19 December, 2017, 04:35:52 pm »
(click to show/hide)

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