Author Topic: Advent of Code  (Read 109960 times)

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #50 on: 12 December, 2015, 12:28:51 pm »
Day 3 has got me puzzling. There must be a quicker way of doing it than just moving around a virtual x and y grid. Something to do with summing up all the moves or something.

But it's beyond my brain to figure it out.

So, I'm sticking with trekking a counter around a virtual board. Which will take me long enough to actually programme - it's taken me this long to work out how to get hold of one character at a time.

red marley

Re: Advent of Code
« Reply #51 on: 12 December, 2015, 12:37:57 pm »
Day 3 hint

(click to show/hide)

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #52 on: 12 December, 2015, 12:38:29 pm »
Day 3. I think you have to remember where you have been.
(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 #53 on: 12 December, 2015, 01:31:24 pm »
(click to show/hide)

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #54 on: 12 December, 2015, 01:50:03 pm »
Cracked Day 3 Part 1:

(click to show/hide)

It works but I get shedloads of warnings about unitialised values. I've tried to stop that but failed.

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #55 on: 12 December, 2015, 01:51:48 pm »
I'd deliberately not looked at the hints until now as I wasn't fully stuck.

I think I've sort of done what you describe - but differently.

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #56 on: 12 December, 2015, 02:11:14 pm »
3b's in the bag - and I've done my first subroutines (santamove, and robomove!).

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #57 on: 12 December, 2015, 02:39:33 pm »
I don't even understand the question for Day 4. Well, I do a bit - I vaguely remember some of the jargon.

I'll spend some time on google - that usually cures all ignorance.

But, at first glance, it's either stupidly difficult (write code to do MD5 hashing (whatever that is)) or just boring (keep chucking numbers into existing MD5 functions until you get one back with the appropriate number of zeroes. It's possible I've misunderstood!

red marley

Re: Advent of Code
« Reply #58 on: 12 December, 2015, 03:04:33 pm »
MD5 hashing isn't that different in principle to what you did for Day 3. Hashing is just a transformation of some collection of data (e.g. the row and column representing Santa's location) into a single number known as a hash. The key to making the hashing transformation useful is that you want to be pretty sure that the same original data always gives the same hash, and that data collections that are different give different hashes.

The MD5 and other cryptographic hash transformations have the additional property that given the hash, you cannot easily retrieve the original data. It is now known how to break the MD5 hashing such that you can retrieve the original data, but for the purposes of this advent exercise, that's not necessary.

(click to show/hide)

Afasoas

Re: Advent of Code
« Reply #59 on: 12 December, 2015, 03:26:07 pm »
Just catching up. Day 5 with some regular expressions.
A bit of regex solves anything :)

(click to show/hide)

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #60 on: 12 December, 2015, 03:54:22 pm »
Just catching up. Day 5 with some regular expressions.
A bit of regex solves anything :)

(click to show/hide)

(click to show/hide)

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #61 on: 12 December, 2015, 03:55:35 pm »
Day 5 done.

red marley

Re: Advent of Code
« Reply #62 on: 12 December, 2015, 04:13:25 pm »
I've set up a 'private leaderboard' for YACF if anyone wishes to join it. The access code is 48462-ea506236

Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #63 on: 12 December, 2015, 04:26:22 pm »
I've set up a 'private leaderboard' for YACF if anyone wishes to join it. The access code is 48462-ea506236

I think I must have hit the anon login option as I have the memorable moniker of "anonymous user #49001".

red marley

Re: Advent of Code
« Reply #64 on: 12 December, 2015, 04:43:20 pm »
Should you wish, you can change this to whatever name you use for authenticating access to the Advent site through the 'settings' option.

red marley

Re: Advent of Code
« Reply #65 on: 12 December, 2015, 04:45:14 pm »
Not necessary for completing the task, but as I like drawing pictures this is the pattern of lights for my version of Day 6 part b:


Pancho

  • لَا أَعْبُدُ مَا تَعْبُدُونَ
Re: Advent of Code
« Reply #66 on: 12 December, 2015, 05:42:59 pm »
I've got to out now so can't do any more this eve :(

Also tomorrow's out as I'm picking up my daughter from the airport after 4 months away from home :)

Re: Advent of Code
« Reply #67 on: 12 December, 2015, 06:46:30 pm »
Days 1 - 3 solved using spreadsheets.

It's not efficient and the computer struggles to run the spreadsheets.
Quote from: Kim
Paging Diver300.  Diver300 to the GSM Trimphone, please...

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #68 on: 12 December, 2015, 10:48:12 pm »
Days 1 - 3 solved using spreadsheets.

It's not efficient and the computer struggles to run the spreadsheets.
Tht sounds like masochism. Just becasue you can, doesn't mean you should. You may find Day 4 a bit hard to do on a spreadsheet.
"By creating we think. By living we learn" - Patrick Geddes

Kim

  • Timelord
    • Fediverse
Re: Advent of Code
« Reply #69 on: 12 December, 2015, 10:59:59 pm »
I ended up simulating neural networks using speadsheets for my final year research project (because reasons).  I wouldn't recommend it, unless you specifically want to make Clippy cry, but it's amazing what you can abuse them for if you're sufficiently determined/desperate/masochistic.

Re: Advent of Code
« Reply #70 on: 13 December, 2015, 10:02:05 am »
My reusability of code fell down flat.
Part 5a solved on a spreadsheet
Part 5b used javascipt

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

Re: Advent of Code
« Reply #71 on: 13 December, 2015, 10:15:33 am »
Not necessary for completing the task, but as I like drawing pictures this is the pattern of lights for my version of Day 6 part b:



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

red marley

Re: Advent of Code
« Reply #72 on: 13 December, 2015, 10:19:25 am »
(click to show/hide)

You could have, but I believe each dataset is unique to your ID, so it wouldn't have got you very far.

Pingu

  • Put away those fiery biscuits!
  • Mrs Pingu's domestique
    • the Igloo
Re: Advent of Code
« Reply #73 on: 13 December, 2015, 12:06:39 pm »
I must be missing something obvious in 6a. It doesn't look that difficult, but I'm not getting the right answer. My code seems to work for small data sets, but fails for the full problem set.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Advent of Code
« Reply #74 on: 13 December, 2015, 01:23:10 pm »
I must be missing something obvious in 6a. It doesn't look that difficult, but I'm not getting the right answer. My code seems to work for small data sets, but fails for the full problem set.
Off by one error somewhere?

I reverted to building a 2D matrix in numpy

I couldn't readily work out an elegant way of solving 11, and by the time I had thought about how to solve it I already had by inspection.

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