top | item 32235340

(no title)

gereleth | 3 years ago

I didn't use any special coordinates, just some trigonometry. My code transforms coordinates between (x,y) - for drawing, (row, column) - for finding neighbours and (index into an array of tiles) - for managing state. It sort of grew organically and could probably be cleaned up a lot.

The hardest part was making the board repeat for the wrap variant making sure that all tiles have consistent wrap neighbours. I almost deployed a version that worked fine on odd-sized grids and went completely bananas on even-sized grids. The danger of always testing on a 5x5 board)).

discuss

order

No comments yet.