Skip to content

georgiee/advent-of-code-2016

Repository files navigation

Advent Notes

  • Day01 and Day02 are running with webpack (npm start)
  • Day03 with Swift (xcode playground, input is read from Resources/ (browse via xcode or show package content on osx))

This was fun. I first visualized the walking and was nearly able too visually identify the solutions of the base excercise AND the additional second start excercise. In the end I over engeneered it and calculated the intersection with more math than necessary in this grid based world.

Have a look (console + output):
https://jsfiddle.net/5j9g0gLv/

Easier than Day 01. Beginning with rows & columns and a simple move check was just the right decision for the second star variant.

Have a look (console):
https://jsfiddle.net/72eenf3g/

Swift Time with xcode's swift playground. Reading again the language guide. I did it before and before. Waiting to reach the point when I know how to make the input a collection of the tuples.

Screw you regex in swift. That's seems to be stupid complex in comparison to other languages. But well it works. Jeez that playground is so slow. To process 1600 lines of a text file it takes more than 30 seconds. It's fixed by putting functions your are not 'playing' with in an external file in Sources/ so they are not analyzed during runtime by the playground. Now it runs well under 2 seconds.

Yeah let's try go.

brew install go and some other worspace settings to use go tools.
Hard parts were: Sorting
Love the ubiquitous for-loop

Tour of Go is working well for beginners with programming experience.
https://tour.golang.org/welcome/1

Running example is here;
https://play.golang.org/p/f2YkTqh5Hk

Awesome start of the day with elixir. What a brilliant peace of art this programming language 👊😍

Love: the pattern matching and the guards.
Hard parts: Getting into the functional thinking mood.

Again lovely pattern matching, Currying, higher order functions. I feel like walking out of Platon's cave 😎

Super easy to combine different functions which is the spirit of functional programming.

Solution for second version of the problem was a matter of seconds as I jsut switched the comparing function.

I was addicted to Haskell in a matter of seconds. So I wanted to spend another day with it. Especially as I could try out the fantastic parsec library to parse any file format you can imagine. This was fun. But it was the easy part.

After that I Struggled with the variable types (Address, Hypernet) I defined to extract the real string value (not the one generated by show) I also searched a long time to seaprate the address parts from the hypernet part. I looked at groupby far too long. It's just filter with a pattern matching function. This to find was worth 2h of my evening.

The solution for part 1 is really nice and after tidying up it can look beautiful too. The solution for part 2, well that got ugly as I just wanted to get the solution as it got late 😴 But anyway I got the solution, yeah!

Other pitfalls: Left/Right decoding, calling of windowed with paranthesis + space is weird windowed function is pretty nice, parsing is awesome

Nothign special, I chosse JS for a little canvas rendering as I wanted to drop in a 3d renderer instead later. But no time.

This was crazy. Thanks to StringScanner I got a solution for part 1 realtive quickly. But oh boy, part 2 was hard and my solution needs a calculation time of nearly 30mins. There are other solutions working in a matter of milliseconds 🙄 Well I call it a day now.

Programming Arts

Elixir, Haskell, Smalltalk, Scratch (Kids Programming)

Day10

Failed. Too much time realizing that it's a graph problem.

Day11

It's about buildig up an algorithm AND performing an optimization if you are not picking up the algorithm already done from somewhere. I had no time doing so much.

Yeah. Easy again. This is more or less building a computer processing instructions. This was fun.