Source: Day 19: Linen Layout
Full solution for today (spoilers!).
Part 1
Given a comma delimited list of substrings and a list of strings, count how many of the latter strings can be made up of any (repeating) combination of the former.
Full solution for today (spoilers!).
Given a comma delimited list of substrings and a list of strings, count how many of the latter strings can be made up of any (repeating) combination of the former.
Full solution for today (spoilers!).
Implement a virtual machine. The machine will have 3 unbounded signed registers, 8 opcodes (see below), a variable parameter scheme (see below that). You will be given the initial values of the 3 registers and a program. Find the final output.
Opcode | Instruction | Description | Notes |
---|---|---|---|
0 | adv reg/val | A = A >> OP | |
1 | bxl val | B = B ^ OP | |
2 | bst reg/val | B = OP & 0b111 | |
3 | jnz val | If a =/= 0 , jump to LIT | |
4 | bxc ignore | B = B ^ C | Still takes param, but ignores it |
5 | out reg/val | Output b | Only outputs lowest 3 bits |
6 | bdv reg/val | B = A >> OP | Same as adv but writes to b |
7 | cdv reg/val | C = A >> OP | Same as adv but writes to c |
For instructions that can take reg/val
, 0
to 3
(inclusive) are treated as literal values, 4
is register A
, 5
is B
, 6
, is C
, and 7
is an error (should never happen).
For instructions that only take val
, it’s always a literal value in the range 0
to 7
(inclusive).
Full solution for today (spoilers!).
Given a result and a list of numbers, determine if any combination of addition (
+
) and/or multiplication (*
) using all the given numbers in order can return the result. Ignore order of operations.
Another Rust Solvers puzzle: Cosmic Express. Basically, it’s a routefinding puzzle. You have a train that needs a track from entrance to exit, picking up and dropping off cargo on the way.
It’s actual a relatively simple puzzle, so far as things go, but one thing that’s interesting from a solving perspective is that branching paths really don’t work great with my solver code. Paths just have a crazy branching factor when compared to (for example) playing one of a handful of cards.
But it’s still an interesting puzzle!
Another day (week? month?), another puzzle game.
This time around, we’re going to solve Golf Peaks. I picked this up a while ago on iOS, but only recently on Steam. It’s a cute little puzzle game themed around minigolf.
Basically, you’re on a grid and you have to get the ball (in the bottom in that screenshot above) to the flag (currently at the top). You have a set list of moves you can take, styled as cards–all of which either move a certain number of tiles in a specific direction or possibly jump into the air (and fly over obstacles).
It gets more complicated from there, but hopefully you have the basic idea. 😄
Another solver that I’ve been working on, after A Good Snowman Is Hard To … Solve?. This time, we have Sokobond! It’s a Sokobon… but with chemical bonds! Yeah, that’s a really good title.
The basic idea is you have a field of elements with (chemical accurate) free electrons):
Here we have 4 hydrogens (1 bond each) and a carbon (4 bonds). It should seem pretty obvious that the carbon should end up with a hydrogen on each end. The one last bit of interest: the element with the dashed border is the one we actually control, that will never change.
This eventually gets more complicated, adding:
It’s a pretty neat puzzle game with 144 levels of increasing difficulty. Perfect to solve.
I enjoy puzzle games. I especially enjoy letting computers solve them for me 😄. Once upon a time, I set up a framework for solving random things. Let’s solve some more.
Today: A Good Snowman Is Hard To Build
It’s a Sokoban about making snowmen! You can push snowballs of three sizes around, collecting snow if you roll over it. You can push smaller snowballs onto bigger ones, stacking them. Or back off, in order to get around one another.
And that’s really it.
There are some interesting twists (multiple snowmen, the ability to leave and re-enter levels, and even a whole second ‘hard mode’), but at a basic level, it’s just pushing.
Given a map with a series of moving walls (that wrap when the hit the edges of the simulation), calculate the fastest route from the top left to the bottom right.
Implement a cellular automaton with the following rules:
NSWE
, SWEN
, WENS
, ENSW
, NSWE
, …)Given a series of given a series of
blueprints
, each of which gives instructions for how to build a singlerobot
from a collection ofmaterials
that in turn will produce one of a givenmaterial
per turn, determine the best order of builds to maximize yourgeode
(the most valuablematerial
) production for eachblueprint
given a time limit of24 minutes
.