6 ms·
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 t
by MrJohz 3y ago
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.
- kqr 3y agoOn the other hand, I liked that I could back out of a mistake with my browser back button!
- jader201 3y agoYeah, I'm thinking that may be a feature, not a bug.
- phkahler 3y ago>> 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!
- sdenton4 3y agoYeah, 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.