-router.get('/', (request, response) => {
- const game = request.game;
-
- if (! request.session.nickname)
- response.render('choose-nickname.html', { game_name: game.meta.name });
- else
- response.render('tictactoe-game.html');
-});
-
-router.post('/move', (request, response) => {
- const game = request.game;
- const square = request.body.square;
-
- const legal = game.add_move(square);
-
- /* Inform this client whether the move was legal. */
- response.send(JSON.stringify(legal));
-
- /* And only if legal, inform all clients. */
- if (! legal)
- return;
-
- game.broadcast_move(square);
-});
-
-router.get('/events', (request, response) => {
- const game = request.game;
-
- game.handle_events(request, response);
-});
-
-exports.router = router;
-exports.name = engine_name;
-exports.Game = TicTacToe;