-router.get('/', (request, response) => {
- const game = request.game;
-
- if (! request.session.nickname)
- response.render('choose-nickname.html', { game_name: "Tic Tac Toe" });
- 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);
+ /* Cannot move to an occupied square. */
+ if (state.board[square])
+ {
+ return { legal: false,
+ message: "Square is already occupied" };
+ }