Fork me on GitHub

Part 2 is always a challenge, but once done, very satisfying. For me 10, 13, 19 were significant challenges so far.


@AC interesting - I am currently working on day 20 part 2. I would think that once the corners are figured out shouldn’t it be linear? Just grab any corner as the top row/col [0 0], then use whichever transform will match an already indexed tile etc…I’m sure there is more 🙂 Ooops sorry, I just realize you were talking about 23

Phil Shapiro16:02:03

I solved day 20 part 2 that way, by picking a corner and placing tiles. It ended up being a fair amount of code. Afterwards I thought that it might’ve been better to place any tile and match tiles to open edges. Once you know which side a tile goes on, you can use a matrix transform to move its pixels into place. Assuming you represent a tile as set of pixels.


Indeed, that’s my strategy as well - probably will try parallelizing on all four corners. The transforms are straightforward with rotation matrices which also take care of flipping. But of course as you say there are all kinds of nifty details…early on, one for me was to re-center/re-scale the tile’s coordinates around the origin in order to do rotations smoothly, then restore to ‘printable’ coords - fun stuff.