19th December solution - Advent of Code 2020 - swift

As part of Advent of Code (adventofcode.com) each day there are two programming tasks to be solved. All solutions are listed here.

I am writing the solutions in Swift with the Playground environment in xCode.

Tasks - 19th December 2020

  1. Examine how many expressions match the given rules, which refer to each other.

  2. Examine how many expressions match the given rules, which refer to each other. Now the rules partly also refert to themselves

For a more detailed description of the tasks check this out.

The lines variable is an array of lines in the txt files given to each member by Advent of Code, which is individual for each user.

The solutions do not differ only the input does. Here is the recursive solution:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview

18th December solution - Advent of Code 2020 - swift

As part of Advent of Code (adventofcode.com) each day there are two programming tasks to be solved. All solutions are listed here.

I am writing the solutions in Swift with the Playground environment in xCode.

Tasks - 18th December 2020

  1. Calculate mathematical expressions from left to right.

  2. Calculate mathematical expressions where addition precedes multiplication operations.

For a more detailed description of the tasks check this out.

The lines variable is an array of lines in the txt files given to each member by Advent of Code, which is individual for each user.

The solutions are only differ in the calcNoBrackets functions. Here are the solutions:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview

17th December solution - Advent of Code 2020 - swift

As part of Advent of Code (adventofcode.com) each day there are two programming tasks to be solved. All solutions are listed here.

I am writing the solutions in Swift with the Playground environment in xCode.

Tasks - 17th December 2020

Game of Life simulation with follwing rules:

  • Active cell remains acitve if exactly 2 or 3 neighbors are active
  • Inactive cell becomes acitve if exactly 3 neighbors are active
  1. Number of active cells after 6 cycles in 3 dimensions
  1. Number of active cells after 6 cycles in 4 dimensions

For a more detailed description of the tasks check this out.

The lines variable is an array of lines in the txt files given to each member by Advent of Code, which is individual for each user.

The solutions are only differ in the type of Coordinate. Here is the solution:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview