Very nice! I like how the state of the game is directly available in the URL - I could send a game directly to another person and have them see the history of the moves I've played, if I understand that correctly.
That said, when I want to go back to the previous page, I now need to click back through the game's history to get there - using `replaceState` from the History API would allow you to keep on using the URL as state, but without clobbering the user's browser history.
>> Very nice! I like how the state of the game is directly available in the URL
I did this same thing with Othello back in 1994 and have been wondering why it never caught on.
I used a CGI program to generate the board. Playable squares were links so the pointer would change. The script made your move, figured out the AI move and spit out the board with a timed reload feeding its own move in. Totally stateless other than the URL.
This one is prettier, but a little less smart. Nicely done!
Yeah, I was surprised that I needed to hit back through an entire game history to get back to the HN discussion...
It would be more reasonable to map the 'undo' button to backspace and a visible button, and keep the browser back button semantics unsurprising. One can also have a string in the window with the current game state for sharing/linking.
That said, when I want to go back to the previous page, I now need to click back through the game's history to get there - using `replaceState` from the History API would allow you to keep on using the URL as state, but without clobbering the user's browser history.