# Diary, December 2021

 ```Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ```

## Wednesday, December 1, 2021

### Advent of Code

With 18 of my colleagues, I joined this years Advent of Code. My programs will be committed to my AdventOfCode2021 repository on GitHub. It took me about an hour to finish todays puzzles.

I have been thinking about how to formulate the puzzle in a manner that does not state anything about how to execute it. On reddit a solution has been published in the programming APL that is probably the shortest possible in any programming language, and which reads: +/¯1↓x<1⊖x (ten Unicode characters requiring fifteen bytes in UTF-8). Although it is very short, it is an executable algorithm. One way to represent the puzzle is with this expression:

```f(A : List of Integer) = count { i | A[i] < A[i+1] }
```
This is a definition of a function, which takes a list of integers and counts the number of succesive pairs where the latter element is larger. The first question is whether it is possible to define semantics such that this can be interpretted in only one way. One possible problem could be how the variable i is dealt with. Maybe in this function it is not a problem, but if it is part of a more complex expression, it could ambigious. This also assumes that we already have read the list of integers from some input. The input for the puzzle is given as a file and it is assumed that the integers are represented as decimal numbers using Arabic numerals in the ASCII encoding. From the input we may also conclude that the integers are small and can be represented as 32-bit integers. Functions or methods to parse numbers in this type of representation are present in most programming languages. Although the expression suggest that the list of integers is passed as a whole to the function, an actual executable implementation does not need to do this, because it could also be implemented using an iterator that reads the input number by number and an implementation of the function that processes the numbers on by one. That is actually how I solved this in my C++ program.

## Thursday, December 2, 2021

### Palindrome date

Today is a palindrome date when written like 12/02/2021 (MM/DD/YYYY) or 2021.12.02 (YYYY.MM.DD). The previous such date was February 2, 2020 and the next will be March 2, 2030.

### Extra puzzle of the first day

I solved the extra puzzle of the first day of Advent of Code with a program that calculates a running sum, but after I had formalized it like the first puzzle, into:
```f(A : List of Integer) = count { i | A[i] + A[i+1] + A[i+2] < A[i+1] + A[i+2] + A[i+3] }
```
I realized, it could be simplified into:
```f(A : List of Integer) = count { i | A[i] < A[i+3] }
```
Which eliminates the need to calculate any sum at all, let alone perform some addition and/or substraction.

### Rijksmuseum Twenthe

In the afternoon, Conny and I visited Rijksmuseum Twenthe. There we saw a number of exhibitions. First of all the exhibition Artemisia: Vrouw & Macht, which is about Artemisia Gentileschi. ("Vrouw & Macht" is Dutch for "Women & Power".) We saw the following paitings:
• Allegorie op de roem, Artemisia Gentileschi, 1630/35.
• Dedalus en Icarus, Orazio Riminaldi, ca.1625.
• Diana, Giovanni Francesco Barbieri, 1658.
• Susanna en de Ouderlingen, Artemisia Gentileschi, ca.1622.
• Susanna en de Ouderlingen, Matteo Loves, ca.1630.
• Heilige Maria Magdalena, Orazio Gentileschi, ca.1620.
• Cleopatra, Artemisia Gentileschi, 1639/40.
• Heilige Maria Magdalena, Artemisia Gentileschi, ca.1610.
• Venus met duiven, Giovanni Antonia Galli, ca.1620.
• Madonna met kind, Artemisia Gentileschi, 1610/11.
• Venus, Mars en Cupido, Luca Gioradano, 1663.
• Heilige Petrus Guido Reni, 1600.
• Judith en Abra met het hoofd van Holofernes, ca.1645/50.
• Bespotting van Christus, Orazio Gentileschi, ca.1628/35.
• Cleopatra, Artemisia Gentileschi, ca.1620/25.
• Christus zegent de kinderen, Artemisia Gentileschi, ca.1626.
• Allegorie op de schilderkunst, Naoplian school, ca.1620/30.
• De dood van Seneca, Gerard van Honthorst.
• Heilige Sebastiaan, Gerard van Honthorst, ca.1623.
• Heilige Maria Magdalena, Artemisia Gentileschi, ca.1630.
• Allegorie op de Retorica, (around her), ca 1650.
• Cleopatra, Artemisia Gentileschi, ca.1630/50.
• Perzische Sibille, Giovanni Francesco Barbieri, ca.1640.
• Heilige Lucia, Artemisia Gentileschi, ca 1636/38.
• Judith en Abra met het hoofd van Holofernes, ca.1610/15.
• Judith en Abra met het hoofd van Holofernes, and/or Orazio Gentileschi, ca.1607/10.
• David met het hoods van Goliath, Giuseppe Vermiglio, ca.1620.
• David met het hoods van Goliath, Artemisia Gentileschi, ca.1631.
• Beul met het hoofd van Johannes de Doper, Salvator Rosa, ca.1639.
• Salomé met het hoofd van Johannes de Doper, Luca Giordano, ca.1652.
• Jaël en Sisera, Artemisia Gentileschi, 1620.
• Erminia en Tancredi, Giovanni Francesco Barbieri, 1618/19.
• Minerva, Artemisia Gentileschi, ca.1635/36.
• Martelaarschap van de Heilige Agnes, Jusepe de Ribera, ca.1630.
• Venus en Adonis, Battistello Caracciolo, ca.1630.
• David loopt triomfantelijk rond met het hoofd van David, Antiveduto Grammatica, ca.1610.
• Bathseba, Artemisia Gentileschi with Bernardo Cavallino, ca.1640/50.

Next we saw the exhibition Deep Truth, which I already visited on Sunday, September 12. We looked at the following works:

During this, we also walked through the normal collection and saw Falaises près de Pourville by Claude Monet. Finally, we saw the two exhibitions part of Fotomanifestatie Enschede:

At 15:47, I bought the following three books in the museum shop:

• Steve Bannon: A Propaganda Retrospective written by Jonas Staal in English and published by Het Nieuwe Instituut in 2018, ISBN:9789082906301, for € 5.00.
• Brewing the Sublime written by Philip Vermeulen in English, second print run on March 23, 2018, ISBN:9781326991807, for € 12.50.
• Artemisia - Vrouw & macht edited by Joost Keizer and Thijs de Raedt in Dutch and published by Waanders Uitgevers in 2021, ISBN:9789462623705, for € 21.96.

Back at the car we noticed condensation on the inside of the car windows and some snow on the car. We concluded that the snow fell during our stay in the musuem. We saw a row of dark clouds on the horizon while driving home.

## Saturday, December 4, 2021

### Advent of Code

This morning, I got up early to solve todays puzzles of Advent of Code. I found these easier than yesterday. Some of my colleagues have been using Excel for solving the puzzles of the past days. Last night, I wrote an additional solution to yesterdays second puzzle. Then I also realized that it would be rather easy to solve it, if you would sort the input data first. You can do this with an external utility or even in Excel, if I am not misstaken. Todays, puzzle is about playing bingo, where you win when you have filled one row of column. Is it possible to create a set of bingo cards, such that no matter in which order you draw the numbers, there is always but one card that wins at when the next number is drawn? It would require that no two cards have a row or a column with exactly the same numbers in it. For each card there are 2.5!.5! ways to arrange the rows and the columns, such that the card will always win at the same moment. What is the largest set of such a set of cards if numbers are taken from a certain range? Of course, this depends on the number of balls you have available.

With respect to Advent of Code, I found the following links:

## Tuesday, December 7, 2021

### Aerosolised droplets

Today, the RIVM included in their statement of how COVID-19 spread, the following sentense: "Under certain conditions, the virus can travel farther, carried in aerosolised droplets that are tiny enough to float in the air, and infect people at greater distances." The sentense basically affirms that COVID-19 is an airborn virus.

## Friday, December 10, 2021

### Book

At 10:19:08, I bought the book Twaalf Twentse tochten written by Truus Wijnen in Dutch and published by Gegarandeerd Onregelmatig in 2014, ISBN:9789078641339, from charity shop Het Goed for € 1.50.

## Saturday, December 11, 2021

### Palindrome date and double date

Today is a palindrome date when the date is written in the format MM/DD/YY: 12/11/21, and a double date for that format. It is also a double date when written in the format YY.MM.DD: 21.12.11.

### Matching brackets

Day 10 of Advent of Code 2021 is about brackets. There are four types of brackets (using ()[]{}<>) and the puzzles have to do with checking if they are matching. This can fail because there are some brackets missing at the end or because there is a mismatch. I decided to use a stack for my implementation of puzzles instead of using a recursive function. I felt that it was the right decision for finishing the puzzles. When I was done, I started thinking about repairing a mismatched sequence of brackets and what would be the minimum number of brackets to insert. It took me some time to come up with an algorithm. It is implemented in the program day10_s.cpp. What it first does is replacing all matched brackets (inside-out) with underscore characters. Next it uses a recursive function to try all possible matchings. For the input given, this runs fast enough, but the complexity is (at least) cubic to the length of the input. Memoization (using a sqaure amouth of memory to the length of the input) can be used to reduce it to at most cubic. I made some searches and made some inquiries (on Twitter, Hacker News, dan Reddit) but did not get any further. I suppose that some research on this must have been done in the past. I suspect that the two type brackets problem is easier than the three or more types of brackets problem.

## Sunday, December 12, 2021

### Hexagonal mazes

Last week, I was going through some old paper, and I found to sheets with hexagonal mazes. Today, I found them (at least one of them) on the website of Olin Shivers. I visited his website before on January 29, 1997, when he was still working at MIT. The mazes can be found on the page Maze generation. He mentions that Robert Givan finished the largest maze by hand. There are good reasons to believe that this is Bob Givan working at Purdue University.

## Saturday, December 18, 2021

### Lockdown

This evening, our government announced that there will be another lockdown starting early tomorrow morning till at least January 14. Although the number of people testing positive on Covid-19 has dropped in the past two weeks by more than a quarter and even the number of people in the hospital has dropped (the number of people in IC only slightly), there is great fear that the Omicron variant will cause those number to increase quickly. Today, I saw the data that from November 29 to and including December 5, about 0.2% of the examined samples were the omicron variant. During that period about 152349 people tested positive, which means that during that period about 300 people were already infected with the omicron variant. Yesterday, it was reported that in the capital city, Amsterdam, about 25% of the examend samples where of the Omicron variant.

## Sunday, December 19, 2021

### Snailfish numbers

Day 18 of this years Advent of Code is about Snailfish numbers. I decided to use a tree representation for my solution, but while I was doing this, I several times complementated to use a flat representation when I was struggling to implement an iterator that walks over the leaves of the tree. It took me 2:20:41 to finish the first puzzle and another ten minutes to solve the second puzzle. Yesterday afternoon, I tried to implement the algorithm using an array to store the numbers together with their depth. But it took me even more time. Then I thought a bit more about it. I realized that the explosions could be done in one pass. I also realized that a split at depth four, leads to a single explosion, which combined lead to a 'distrution' of the value to surrounding values, and which can be done in a single step. I also realized that with some clever moving around this can also be done in a single pass. Today, I worked on a third solution using a double linked list. Because the depth of the numbers is limited to at most four it is a limited depth binary tree, which can be represented by 31 cells. If you decided to use -1 for the representation of a pair, it is possible to use an array of 31 integers. (I used an array of size 32 out of convenience.) The idea is to asume that you have a tree with fullest depth and then you number the nodes, from left to right, starting with 1. During the addition, you temporary need an tree with five levels and thus 63 cells. This evening, I finished the fourth solution with this. I tested the solutions on the example input given at the end of the description for the first puzzle. The code can be found in the program 2021day18.cpp. With the command line option -t, the program gives some detailed output.

## Wednesday, December 22, 2021

### Palindrome date and double date

Today is a palindrome date when the date is written in the format MM/DD/YY: 12/22/21, and a double date when written in the format DD-MM-YY: 22-12-21.

## Saturday, December 25, 2021

### Advent of Code 2021

This evening, I finished all the puzzles of Advent of Code 2021. My programs can be found in this github repository:. I was the 5774th person to finish all the puzzles. Up to and including Thursday, I woke up early every day to compete in the contest against my colleagues. About thirthy of them started out and were about five others still running in the competition. However, on Thurday, I realized that I was taking it far too seriously and I decided to quit the competition with my colleagues, removing myself from the private leaderboard. In the evening, I managed to finish the puzzles of Thursday. Yesterday, I spend at least half of my hours being awake and a some hours into the night to work on yesterdays puzzle without being able to finish the puzzle. Today around noon, I had a quick look at todays puzzle, which did not look so hard. But it was only around nine in the evening that I continued working on the puzzles and managed to finish yesterdays puzzle and todays puzzle (only one). This years winner is Brian Chen with the alias betaveros. On second place is Andrew He.

## Thursday, December 30, 2021

### 14.1° Celsius

Today, Conny and I went for a walk from our home. We did not know whether it would started to rain, so we did not plan to make a long walk at first. But while walking, we decided to go further, because it did not look like it was going to rain and the weather felt warm. At some point, we realized we had dressed ourselves too warm. At home I discovered that during out walk, the temperature at Twenthe Airport had gone up to 14.1° Celsius, which breaks the previous record of 13.0° for the temperature on this date in 1925. This is probably going to be our last walk for this year. Although there is a ban on fireworks this year, we still expect that a lot of illegal fireworks will be ignited tomorrow during the day and the night.

## Friday, December 31, 2021

### Brewing the Sublime

I finished reading the book Brewing the Sublime by Philip Vermeulen which I started reading two days ago, and which I bought earlier this month on the second. It is a small book with a lot of interesting notes with links. There is not an online version with the links. I started my own list:

### 13.8° Celsius

The temperature at Twenthe Airport has gone up to 13.8° Celsius, which breaks the previous record of 13.7° on this date in 2017. But what is more remarkable is that that temperature was reached two times during last night. The temperature did not drop below 12.5° Celsius.

This months interesting links

Home | November 2021 | January 2022
```

```