Inspired by Magnus Hovland Hoff's blog post about hexagonal rails for an OpenTTD style game[1], I wanted to try implementing it myself. Click on an edge between hexagons to toggle a rail connection betwen those tiles. Try click & drag.
See my quick & dirty JS+SVG code, or see Magnus's Rust+SVG code[2].
I'm a fan of using edges for grid logic. As Magnus explains, there are a lot of possible rail configurations in a tile, but if you simplify by having the user control only whether two tiles are connected, it leads to a nice set of track configurations. Does it limit the player too much? Are there too many useless states? Hard to be sure until there's a game to play, but Magnus's demo gives a sense for how well this would work.
TODO: if you are dragging the mouse and drag back over the path you just drew, it should undo the path. Paths would essentially be temporary until you let go of the mouse/finger. I haven't worked out the logic for this. I think I would need to show the path line, and then keep that in a variable. Then if you drag back over the edge at the top of the stack, it'd pop the stack.