Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const tableBody = document.getElementById('game-board');
const winner = document.getElementById('winner')
const gameMaster = new GameMaster()

const tableCells = document.getElementsByTagName('td');
for (let i = 0; i < tableCells.length; i++) {
tableCells[i].addEventListener('click', () => {
gameMaster.markMove(tableCells[i], i);
gameMaster.updateBoard(tableCells);

console.log(gameMaster.moves);
})
}


// const clearButton = document.getElementById('clear');
// clearButton.addEventListener('click', gameMaster.clearBoard(tableCells))
50 changes: 50 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>

<script src="https://kit.fontawesome.com/3941b02c1e.js" crossorigin="anonymous"></script>

<link rel="stylesheet" href="normalize.css" type="text/css" />

<link rel="stylesheet" href="styles.css" type="text/css" />

</head>

<body>
<main>
<h1>Tic Tac Toe</h1>
<button id="clear" type="button" onclick="gameMaster.clearBoard(tableCells)">Empty Board</button>
<h2 id="winner">Winner: </h2>
</main>
<table>
<tbody id="game-board">
<tr>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

<script type="text/javascript" src="src/GameMaster.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>

</html>
Loading