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.
I still don’t understand why React, if Mithril exists. React is what a young hacker would invent under heavy hallucinogens after a week of reading Advanced Haskell tutorials. I can believe it exists. I can’t believe it’s an industrial standard and nobody has a speck in the eye about it.
> React is what a young hacker would invent under heavy hallucinogens after a week of reading Advanced Haskell tutorials
That's precisely why it works: it presents an alternative to the liminality requirements of maintaining the Ballmer Peak (which is is too NP-hard to reproduce) by tapping into the underdeveloped PFCs in young developers everywhere and making them productive by psyop-hacking their sense of adventure into the pursuit of complexity.
It's honestly sad, but a nonetheless really interesting study in emergent psychological dynamics.
You're halfway to a point, but none of those words are used correctly. Something like -
"React is built to appeal to young developers. By being complicated, internally consistent, and "selling itself", it keeps them working long hours on boring business tasks. Practically, it's not the right tool, but it keeps 'em happy and grinding away."
Words misused (all of them):
- liminal = transitional, "between worlds", arguable, but more "flow"
- ballmer peak = coding capability stemming from mild inebriation, not from an old man sense of duty
- NP-hard = difficulty comes from combinatorial explosion, not from the impossibility of making people love spreadsheets
As a used-to-be baby dev, I'd argue the appeal of web frameworks is 2-fold. Structured ways to do complicated stuff, and internal consistency.
I was probably already dealing with the quirky subtle delirium I get with onset head colds/flus when I wrote that yesterday (I'm now past it and at the sniffle stage lol). That's my excuse for the "u ok?" word salad there :P
Some clarifications following this feedback:
- ballmer peak: yep, pretty much - the latter interpretation is new to me
- liminality: the defocused focus referred to in the above, but specifically referring to the need to drink to make it work
- NP-hard: I was trying to make a joke about it being impossible to achieve the effects of the ballmer peak without drinking lol
This is a different contrast though. It could be a great reminder of any ui framework, since “dom” part is barebones and lacks features even compared to early desktop libs.
I chose Mithril with JSX for a real startup's main product. It felt like what I expected React to feel like, and it scaled with no issues. The only downside is that everyone on your team is anxious that they're missing out on marketable React experience.
One of the life lessons of mine is that your UI is probably a much better direction. There is a sort of upper limit beyond which the whole graphical side of things is an absolute distraction to everyone. My gut feeling is the whole Wordle style end of things will be where a lot more future growth occurs.
Thanks! A lot of people commented on the music. I reused it in another game which went slightly viral in the UK and the newsletter responsible said it was "unintentionally creepy" which isn't quite true as it was totally intentional.
Indeed! I basically programmed it to do roughly what I (a total novice) do when I play. Mainly for when my kids want to play and I don’t (or am not around).
For Othello, picking the positionally best square (corners very good, adjacent to corners very bad, 2 squares from corner good, etc.) beats lookahead, likely because having unflippable pieces in good positions leads to large swings in score in the endgame that a short lookahead won't see.
I play almost purely positionally with no conscious lookahead and I beat it soundly every time, playing as both black and white, frequently with the AI having to pass because it had no legal moves.
A "don't yield a corner" heuristic to never move in the three squares around a corner unless there are no other legal moves would likely significantly strengthen its play.
That’s interesting, thanks. Can I read up somewhere about these positional principles? It’s not immediately obvious to me why positions adjacent to the corner are so poor.
EDIT: ah, I guess it’s because it gives the corner to your opponent.
I wouldn't describe myself as a "better Othello player", but I managed to thoroughly beat it with the simple strategy of occupying the corners of the board as soon as possible...
I only this week was taught to play Othello by a young child in my life, so I appreciate seeing this pop up. It was interesting playing through the whole game and then rewinding with the back button. Not how the back button is "supposed to be" used, but it was fun to rewind and think about fixing some rookie mistakes. Thanks for the fun!
In response to some of the comments here, I've just (11.45 GMT) tweaked the 'AI' to give even greater weight than before to corner and edge positions, which might make it a little stronger.
The key to winning Othello is getting the corners. Controlling the edges helps a ton in getting the corners. Avoid the 2x2 corner areas unless you know you can get the corners.
Using these tips alone should help you (easily?) beat the AI here, as it does a lot of mistakes.
The key to winning Othello is getting the corners. Controlling the edges helps a ton in getting the corners. Avoid the 2x2 corner areas unless you know you can get the corners.
Using these tips alone should help you (easily?) beat the AI here, as it does a lot of mistakes.
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.