1 const express = require("express");
2 const Game = require("./game.js");
4 const router = express.Router();
6 class TicTacToe extends Game {
11 board: Array(9).fill(""),
16 /* Returns Boolean indicating whether move was legal and added. */
18 /* Cannot move to an occupied square. */
19 if (this.state.board[square])
22 this.state.board[square] = this.state.next_player;
23 this.state.moves.push(square);
25 if (this.state.next_player === "X")
26 this.state.next_player = "O";
28 this.state.next_player = "X";
34 exports.router = router;
35 exports.Game = TicTacToe;
39 identifier: "tictactoe"