/* Returns a fresh game. */ export function newGame() { return { "state": "waiting", // or "waiting" or "won" or "tie" "board": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], "next": 1, // 1 or 2, the player whose turn it is, the winner if state is "won" "player1": undefined, "player2": undefined, } } /* Drops a piece into given column. */ export function dropPiece(game, column) { ... }