Russ Cox
swtch.com
Russ Cox
@swtch.com
Heading home from #GopherCon 2025 in NYC. As usual, many people asked how to get one of the amazing Go gopher Hawaiian shirts by Renee French. I've posted the details at github.com/rsc/gophersh.... (I know one person who has made pajama pants with the pattern. Socks might be nice too.) Enjoy!
August 29, 2025 at 4:02 PM
Day 4 part 2 #AdventOfCode

d shift3 m produces the 3 matrices shifted by d*-1 0 1.
d MAS m identifies the A in MAS in direction d.
d xMAS m identifies the A in MAS in direction d or -d.
xMAS m identifies the A in an X-MAS.
December 4, 2024 at 2:48 PM
Day 4 part 1 adventofcode.com/2024/day/4 #AdventOfCode

pad dot-pads the matrix to avoid wraparound.
x y shift m rotates the matrix x left, y down.
d(=x y) shift4 m produces the 4 matrices shifted by d*0 1 2 3.
d XMAS m identifies the X in XMAS in direction d.
December 4, 2024 at 2:42 PM
Day 3 part 2.

The function 'c step2 s' is the updated state machine, with an extra value tracking whether mul(x,y) is enabled. step2 takes care of do()/don't() processing and invokes 'step' (from part 1) to handle mul(x,y) when appropriate.
December 3, 2024 at 6:27 AM
Day 3 part 1.

The function 'c step s' steps the state machine state s to incorporate the new character c.

(step/ flip x) runs the state machine over the whole string, left to right.

The reduction base case for "...yz" is 'y' step 'z', which step rewrites to ('y' step 'z' step initial-state).
December 3, 2024 at 6:25 AM