News for hackers. Stuff that matters.
Re:Show HN: My Weekend Project - Multiplayer TicTacToe by daakus on Sunday January 09, 2011 @01:47AM (#2085033)
Unnecessary plug: I wrote a ridiculously simple version using node and socket.io to get a feel for this too: https://github.com/nshah/tictactoe -- it only has random matchup mode. It's running here: http://tictactoe.daaku.org:9999/
Re:Show HN: My Weekend Project - Multiplayer TicTacToe by ericlavigne on Sunday January 09, 2011 @11:00AM (#2085634)
Nice work.

After waiting 10 minutes for an opponent, I opened a second tab and played against myself. Until your application becomes immensely popular, and this issue goes away, it would be nice to have an estimate of wait time.

Just keep track of recent "new opponent" events (keeping times of the most recent 10 events is sufficient) such as new visitor arriving, game ending, or server starting up (the last one just handles the edge case when you are the first player to load the application). Time elapsed since the earliest event (including only the 10 most recent events) divided by the number of events (again, this is at most 10) yields a reasonable estimate of wait time.

Alternatively, you could pair someone with a computer player if they've been waiting for more than a minute. https://github.com/ericlavigne/tic-tac-toe/blob/master/src/t...