Source: Particle Swarm
Part 1: Given the initial position, velocity, and acceleration of a large number of particles, which particle will stay the closet to the origin as the simulation runs to infinity?
Part 1: Given the initial position, velocity, and acceleration of a large number of particles, which particle will stay the closet to the origin as the simulation runs to infinity?
Part 1: Take a network diagram of the following form:
|
| +--+
A | C
F—|–|-E—+ | | | D +B-+ +–+
> Starting at the single node at the top and following the lines, what order would the nodes be visited in?
First, load the entire network:
```python
data = {}
points = {}
entry = None
def is_point(c):
return re.match('[A-Z]', c)
for y, line in enumerate(lib.input()):
for x, c in enumerate(line):
if c.strip():
data[x, y] = c
if is_point(c):
points[c] = (x, y)
if y == 0 and c == '|':
entry = (x, y)
Then, calculate the path:
Part 1: Create a virtual machine with the following instruction set:
snd Xplays a sound with a frequency equal to the value ofXset X Ysets registerXtoYadd X Yset registerXtoX + Ymul X Ysets registerXtoX * Ymod X Ysets registerXtoX mod Yrcv Xrecovers the frequency of the last sound played, ifXis not zerojgz X Yjumps with an offset of the value ofY, iffXis greater than zero
In most cases,
XandYcan be either an integer value or a register.
What is the value recovered by
rcvthe first timeXis non-zero?
Part 1: Start with a circular buffer containing
[0]andcurrent_position = 0. Fornfrom1up to2017:
- Step forward
steps(puzzle input)- Input the next value for
n, setcurrent_positionton, incrementn- Repeat
What is the value after 2017?
It’s a bit weird to describe, but the given example helps (assume steps = 3):
(0)
0 (1)
0 (2) 1
0 2 (3) 1
0 2 (4) 3 1
0 (5) 2 4 3 1
0 5 2 4 3 (6) 1
0 5 (7) 2 4 3 6 1
0 5 7 2 4 3 (8) 6 1
0 (9) 5 7 2 4 3 8 6 1
Part 1: Running on the string
a...papply a series of the following commands:
sXrotates the string right byXpositionsxX/Yswaps positionsXandYpA/Bswaps the lettersAandBno matter their positions
Part 1: Create a pair of generators
AandBwhere:
- A_n = 16807 A_{n-1} \mod 2147483647
- B_n = 48271 B_{n-1} \mod 2147483647
How many of the first 40 million values have matching values for the low 16 bits of each generator?
Part 1: Create a 128x128 grid. Generate each row by taking the knot hash of
salt-{index}. The bits of the hash represent if a tile in the grid isfree(0) orused(1).
Given your salt as input, how many squares are
used?
Part 1: Multiple layers are defined with rules of the form:
- {index}: {depth}
Each layer will start at position 0, then once per tick will advance towards depth. Once it hits
depth-1, it will return to position 0, taking2*depth-1per full cycle.
Calculate the sum of
index * depthfor any scanners that are at position0when you pass through them given an initial starting time.
Part 1: A network of nodes is defined by a list of lines formatted as such:
2 <-> 0, 3, 4In this case, node
2is connected to0,3, and4and vice versa.How many nodes are in the group that contains the node
0?
Part 1: Work on a hex grid:
\ n / nw +--+ ne / \ -+ +- \ / sw +--+ se / s \Given a series of steps (
n,se,ne) etc, how many steps away from the origin do you end up?