diff options
| author | Jean-Pierre Appel <jeanpierre.appel01@gmail.com> | 2023-10-24 12:26:56 -0400 |
|---|---|---|
| committer | Jean-Pierre Appel <jeanpierre.appel01@gmail.com> | 2023-10-24 12:26:56 -0400 |
| commit | a5ac4b6b9f2bfc6b9eb261b5ba5dc70e17e1c8b6 (patch) | |
| tree | c1f83feaad5807569467d6d0a5317f7c75982358 /site/game.js | |
| parent | e6bcd662d40e3d5d32d6cbe8faad953aac3a9581 (diff) | |
minor styling
Diffstat (limited to 'site/game.js')
| -rw-r--r-- | site/game.js | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/site/game.js b/site/game.js index e0015be..ee52509 100644 --- a/site/game.js +++ b/site/game.js @@ -1,6 +1,18 @@ const order = document.getElementById("graphOrder"); -//TODO: read in player's name +const test_bttn = document.getElementById("test_bttn"); +const optionsScreen = document.getElementById("optionsScreen"); +const gameScreen = document.getElementById("gameScreen"); +const gameContainer = document.getElementById("game"); +const testGame = { + size: 7, + finished: false, + board: Array(7).fill(true), + turn: 0, + version: "0.0.0", + human_turn: false, + winner: "" +} function createGame(length){ const game = { @@ -13,10 +25,22 @@ function createGame(length){ winner: "" } //TODO: create game in DOM + gameContainer.innerText = "" + game.board.forEach((status) => { + let light = document.createElement("div"); + light.classList.add('vertex') + gameContainer.appendChild(light) + }) return game; } -function humanPlay(game){ +function toggle_screen(){ + optionsScreen.classList.toggle('inactive'); + gameScreen.classList.toggle('inactive'); + renderGame(testGame) +} + +async function humanPlay(game){ } @@ -37,15 +61,23 @@ async function sendGame(game){ "Content-Type": "application/json; charset=UTF-8" } }) - return JSON.parse(response.json()) + return response.json() +} + +async function gameLoop(){ + } function playGame(){ - const length = order.valueAsNumber; - const game = createGame(length); - console.log(sendGame(game)) + //const length = order.valueAsNumber; + //let game = createGame(length); + //game = sendGame(game); + //window.alert("Game Play Not implemented yet") + const game = createGame(7) + renderGame(game) //while(!game.finished){ - // game.nextTurn(game.turn); + // humanPlay(game) + // // game.nextTurn(game.turn); //} // displayMessage(game.result); } |
