Skip to main content

C'est la Z

Tag: Advent of Code

A Teacher Looks at Advent of Code 2020 - day 16

Today's problem was a fun one to solve. Why was it fun? Stay tuned, The basic gist is that you have a plane ticket which is a set of numbers but you don't know which number maps to which category - row, seat, gate, etc. You also know the number ranges for each category. For example, row might be a number between 6 and 11 or 33 through 44 while a seat might be 13 through 40 or 45 through 50.
# COMMENTS

A teacher looks at Advent of Code day 14

Time for Day 14!!! I didn't write up day 12 but here's a Clojure video runthrough. I also didn't write up day 13 mostly because I hacked together my part 2 in Python and still want to rewrite it in decent clojure. In any event, all my solutions are up on GitHub. Day 14 had a few interesting things going on. At its core it's a small machine simulator where you have to deal with binary numbers.
# COMMENTS

A teacher looks at Advent of Code 2020 - Day 11

Today was Cellular Automaton Day at Advent of Code. You have a world that's usually represented as a grid of cells. Each cell can be in a certain state. Given a certain state, the next state is determined by simple rules like for a given cell how many of it's neighbors are the same color. The most popular Cellular Automat is probably Conway's Game of Life where each cell can be either alive or dead in a given generation and in the next generation the state will be determined by how many of its neighbors are currently dead or alive.
# COMMENTS

A Teacher looks at Advent of Code 2020 - days 9 and 10

As we get closer to the end of the semester and time becomes scarcer I'm wondering how many more I'll finish. Barely had time to do days 9 and 10. Not much to say about day 9 Part one was basically a rehash of day 1 part 1 but with a sliding widow. Part 2? I just brute force tried all the subranges. I meant to go back to try to improve the solution but didn't have a chance.
# COMMENTS

A Teacher looks at Advent of Code 2020 - Days 7 and 8

Today we'll talk about days seven and eight. Let's start with 7. I teach all morning on Mondays. I woke up and worked out and then took a look at the problem in the few minutes before class. It was certainly harder than days one through six but I felt it was something I knew I could do based on past experience so I quickly started to throw something together.
# COMMENTS

A Teacher looks at Advent of Code 2020 - Day 06

Day 6 turned out to be pretty straightforward. Like day 4 you had to deal with two consecutive newlines when parsing the data but assuming you did day 4 that's no problem. The gist is that a group is formed by consecutive lines and groups are separated by a blank line. Each line in each group is a string of letters representing answers to questions. For instance, for this group: abc abd ab you have three people.
# COMMENTS

A teacher looks at Advent of Code 2020 - Day 5

Day five's problem is a nice one for an early CS class. It can be very much brute forced but it also touches on some nice concepts and can be solved pretty elegantly. I've embedded a walk through in Clojure at the end but a Python solution would be pretty similar. Read the problem over if you haven't. At it's core you are taking a boarding pass representing a coded airplane seat number and you're converting it to a known seat (row and column).
# COMMENTS

A Teacher Looks at Advent of Code 2020 - Day 4

One of the nice things about Advent of Code is that it gets me to explore language features I haven't used yet. Today's problem got me to explore Clojure Spec which is a very cool validation library. There's a complete run through of the solution in Clojure in the video but here I'll talk about the problem in Python (mostly). Today's problem is about validating passports. You start with a text file consisting of passport information.
# COMMENTS

A Teacher Looks at Advent of Code 2020 - Day 3

I thought I'd do a video for today. No particular reason. Mostly why not. I'll talk about day 3's problem and code up a solution in Clojure. If you haven't ever used Clojure, hopefully this will give a bit of the flavor. This video also serves double duty as being my next Using Emacs video since it demos Emacs's Clojure tools. Mostly Cider which even with a few quirks is the best development environment I've ever used.
# COMMENTS

A Teacher Looks at Advent of Code 2020 - Day 2

Day two introduced some staples of staples of not only Advent of Code but also of programming problems in general. The first is input parsing. For this problem you get lines of input like this: 1-3 a: abcde 1-3 b: cdefg 2-9 c: cccccccc or in general number_1-number_2 Letter: String There are a few ways to handle this. One is to brute force it. In Python maybe something like: sample_line="4-15 f: abcdefg" sample_list = sample_line.
# COMMENTS