Author Topic: Advent of Code  (Read 112635 times)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #125 on: 18 December, 2015, 07:49:13 am »
Day 18, those blinking lights again.
I didn't use recursion. Fortunately my approach meant that part B required minimal extra coding
(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 #126 on: 18 December, 2015, 10:29:12 am »
Day 18, those blinking lights again.
I didn't use recursion. Fortunately my approach meant that part B required minimal extra coding
(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

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #127 on: 18 December, 2015, 10:12:41 pm »
As Mr Wall says: TMTOWTDI
It was pleasantly easy. I was expecting something like 'if the bulb has been on for 10 iterations continuously it burns out and is permanently off'
"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 #128 on: 19 December, 2015, 12:28:33 am »
Indeed,  the part 2 variation was less taxing than I expected.

I was doing a bit of self-searching about which days i found hardest so far, and from memory the hardest two were

1. day 8 (the string storage thing)
(click to show/hide)
2. day 7 (the circuit thing)
(click to show/hide)

In terms of raw amounts of code (stripping comments), they rank as follows:-

Code: [Select]
oaky@jarlsberg ~/Dropbox/AdventOfCode $ for i in */s*.py; do echo `grep -v '^[ ]*#' $i |  wc -l` $i;done | sort -n
22 1/s1.py
26 2/s2.py
32 4/s4.py
48 17/s17.py
51 8/s8b.py
55 10/s10.py
58 12/s12.py
62 8/s8.py
71 14/s14.py
77 16/s16.py
82 3/s3.py
91 15/s15.py
95 13/s13.py
99 9/s9.py
100 6/s6.py
104 11/s11.py
137 5/s5.py
150 18/s18.py
173 7/s7.py

although it's skewed somewhat since after the first couple of days I started using a unit test framework for varying levels of testing within the script itself (some of the lmid to ater ones were more than 50% test code).
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 #129 on: 19 December, 2015, 12:31:45 am »
from twitter earlier:-

Quote
Eric Wastl ‏@ericwastl 3h3 hours ago

If #AdventOfCode were a roller coaster, we're about to reach the corkscrews and loops and the part where it takes your picture.
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 #130 on: 19 December, 2015, 06:12:14 am »
Today's is right up David Martin's street.

Part two feels like a proper workout for me at least. I'm impressed that the highest entry on the leaderboard managed both parts within 18 minutes of the puzzle being released.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #131 on: 19 December, 2015, 09:51:49 am »
I've just done part one which was easy. I'm thinking about part 2.
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #132 on: 19 December, 2015, 12:04:45 pm »
Took a couple of days off. Just finished day 11. The concept wasn't difficult, but it took me a while to sort out the letter incrementing business.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #133 on: 19 December, 2015, 04:18:13 pm »
Well that doesn't work for day 19 as the time/space required is too big. This requires more thought.
"By creating we think. By living we learn" - Patrick Geddes

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #134 on: 19 December, 2015, 07:20:57 pm »
Finally found an answer to Day 12b (JSON parsing)

(click to show/hide)
(click to show/hide)

I'm on 12b now. It's a bit of a bastard. I've not opened the spoilers (yet).

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #135 on: 19 December, 2015, 09:19:20 pm »
I had a look at a spoiler for 19
(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 #136 on: 20 December, 2015, 01:30:06 am »
19b is eluding me for now, although I'm sure my BFI (brute force and ignorance) approach isn't the best.

I'm going to leave the BFI job running overnight, since it's not apparently consuming exponential memory, but in the morning, I am going to try a different approach:

(click to show/hide)

It may not help, but it beats abusing the company AWS account to do an expensive massively parallel brute force search ;)
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 #137 on: 20 December, 2015, 11:10:47 am »
I think your revised approach is by far the most sensible (which is why I started with that. Still haven't managed a suitable solution though I think I know how to find one.
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

red marley

Re: Advent of Code
« Reply #138 on: 20 December, 2015, 05:30:21 pm »
Still working on an efficient way of reducing the search space for day 19b.

Day 20 is much easier...

(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #139 on: 20 December, 2015, 08:38:03 pm »
I haven't had a chance to look at 20 as my laptop has decided to overheat and kill the graphics every hour or so.
(click to show/hide)
"By creating we think. By living we learn" - Patrick Geddes

Afasoas

Re: Advent of Code
« Reply #140 on: 21 December, 2015, 09:23:39 am »
I took a look at day 7 yesterday and found myself in a perpetual state of confusion.

I might try and take another look at it tonight.

red marley

Re: Advent of Code
« Reply #141 on: 21 December, 2015, 11:43:03 am »
I now have a solution for 19b, Kicking myself I didn't get it earlier.

(click to show/hide)

Afasoas

Re: Advent of Code
« Reply #142 on: 21 December, 2015, 05:31:47 pm »
For 7b, I found someone elses explanation of the problem and now I think I understand it.
I've also found out where the bitwise operators are in PowerShell*.


*I'm learning C and Ruby, I've a smattering of experience with Python, PHP and C#. But I'm nowhere near as proficient in those as I am with PowerShell. I figure if I find time to complete all the chellanges in PowerShell, I can try porting my solutions to other languages.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #143 on: 21 December, 2015, 05:49:16 pm »
Laptop was taken to laptop hospital and I really must finish my coursework marking before getting on with AoC.
"By creating we think. By living we learn" - Patrick Geddes

Afasoas

Re: Advent of Code
« Reply #144 on: 21 December, 2015, 09:13:49 pm »
Still stuck on day 7. I think my logic is sound.
I'm either hitting PowerShells limitations or I'm using it wrong.

Code: [Select]
[uint16]$foo = 1
[Uint16]$bar = $foo -shl 2
[Uint16]$car = $foo -shl 15
[Uint16]$har = $foo -shl 16
write-host "foo: $foo"
write-host "bar: $bar"
write-host "car: $car"
write-host "har: $har"

Output:
Code: [Select]
foo: 1
bar: 4
car: 32768
har: 0


On Edit: I'm being dufus. "shl" and "shr" are working as expected. ... **goes back, stares at code**

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #145 on: 22 December, 2015, 09:29:28 pm »
Finally found an answer to Day 12b (JSON parsing)

(click to show/hide)
(click to show/hide)

I'm on 12b now. It's a bit of a bastard. I've not opened the spoilers (yet).

12b done at last (without spoilers)!  :thumbsup:

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #146 on: 23 December, 2015, 11:35:32 pm »
Day 13 completed via a mix of Javascript and spreadsheet. Very much like day 9.

Re: Advent of Code
« Reply #147 on: 24 December, 2015, 06:30:48 pm »
Yikes, made a bit of meal out of day 9, but quite happy with what I ended up with.
Quote from: tiermat
that's not science, it's semantics.

Re: Advent of Code
« Reply #148 on: 24 December, 2015, 07:47:17 pm »
Quite pleased with this for day 10

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

Re: Advent of Code
« Reply #149 on: 25 December, 2015, 06:34:52 am »
In 12b, does "red" after an object mean that the object is ignored?

e.g. { 1, 2, {3, 4} , red }

Should that be 7 or 0?
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...