advent of code 2019, problem 15.2

For day 15 we are given the programme for a robot that can help us explore a maze.

3,1033,1008,1033,1,1032,1005,1032,31,1008,1033,2,1032,1005,1032,58,1008,1033,3,1032,1005,1032,81,1008,1033,4,1032,1005,1032,104,99,101,0,1034,1039,1002,1036,1,1041,1001,1035,-1,1040,1008,1038,0,1043,102,-1,1043,1032,1,1037,1032,1042,1105,1,124,1001,1034,0,1039,1001,1036,0,1041,1001,1035,1,1040,1008,1038,...

So we wrote a controller that used a simple wall follower maze solving algorithm to map out the maze.

While mapping the maze the robot tells us the location of an oxygen cylinder. The answer to part one is the distance from the robot’s starting location to the oxygen cylinder.

The answer to part to is to calculate how long it would take the oxygen to fill the maze assuming that the oxygen can move one step per minute.

The following video shows a simulation of the oxygen filling the maze.

advent of code 2019, problem 13.2

Advent of Code is an advent calendar of small coding problems. Typically, solutions to later problems rely on extending tools you create to solve earlier problems.

This year we have built a virtual computer to run programmes to solve some of the problems.

In problem 13 we are given a computer programme for a game and asked to find the final score when the game ends.

Here is a sample of the start of the programme:

1,380,379,385,1008,2267,610415,381,1005,381,12,99,109,2268,1101,0,0,383,1101,0,0,382,20102,1,382,1,20101,0,383,2,21101,37,0,0,1106,0,578,4,382,4,383,204,1,...

The programme can be run and the score read from the output.

But to make this more interesting I created a “computer screen” to show the game running.

%d bloggers like this: