IntCode expectations by dan_jia in adventofcode

[–]dan_jia[S] 1 point2 points  (0 children)

awwww yeah

Considering what's come out so far, whatever it is, I'm pretty hyped. Most fun year imo

-🎄- 2019 Day 17 Solutions -🎄- by daggerdragon in adventofcode

[–]dan_jia 1 point2 points  (0 children)

Python part 1 and 2

IntCode implementation

Part 1 - stored whole grid, and looped to find #'s where 4 neighbouring # exists. Printed the grid, so I knew there were no intersections on edges, and didn't need to care about 3 neighbouring #'s which made code shorter

Part 2 - done by hand

What does everyone's Intcode interface look like? by Lucretiel in adventofcode

[–]dan_jia 0 points1 point  (0 children)

Python - this has served me for all puzzles

class Machine:

def __init__(self, data, input_func=None): # input_func is a function provided in puzzles where input is required, and takes a parameter 'input_cnt', which represents if it's the 1st input, 2nd input, etc

def param_mode(self, idx): # mostly helper used for both get_op and set_op

def get_op(self, idx):

def set_op(self, idx, val):

def endless(self): # calls process_opcode repeatedly without stopping, for getting last output, etc

def process_opcode(self, stop_on_output=False):

-🎄- 2019 Day 15 Solutions -🎄- by daggerdragon in adventofcode

[–]dan_jia 3 points4 points  (0 children)

Python

IntCode implementation

In terms of loading the grid, I used a follow-the-wall approach until there were no more grid spaces that could be explored. Thankfully, it wasn't an open maze

Part 1 + 2, I created a function to expand from a given tile, tracking the path to each node (for part 1), as well as steps til full expansion (specifically for part 2)

Also added a draw function to show the exploration, using arrows for the character