feat: added grid and basic styling

This commit is contained in:
Smigz 2023-12-14 10:32:14 -05:00
parent 8a97cde4fa
commit 358c1c524c
3 changed files with 48 additions and 5 deletions

View file

@ -20,3 +20,13 @@ header h1 {
justify-content: center;
align-items: center;
}
.content>.game-area {
display: grid;
grid-area: 1 / 1 / 4 / 4;
gap: 15px;
grid-template-rows: repeat(3, 50px);
grid-template-columns: repeat(3, 50px);
justify-items: center;
align-items: center;
}

View file

@ -24,5 +24,6 @@
<div class="footer"></div>
</footer>
</div>
<script src="./js/main.js"></script>
</body>
</html>

View file

@ -143,7 +143,7 @@ const gameController = (() => {
marker.addToken(player);
tictactoeBoard.placeOnBoard(position, marker); // position on board
tictactoeBoard.printGameBoard();
let gameOver = evalGameOutcome(tictactoeBoard);
let gameOver = evalGameOutcome(tictactoeBoard.getGameBoard());
if (!gameOver) {
switchPlayerTurn();
}
@ -192,10 +192,42 @@ const gameController = (() => {
return { playRound }
})();
gameController.playRound(2);
gameController.playRound(4);
gameController.playRound(4);
gameController.playRound(5);
const screenController = (() => {
const gameDiv = document.querySelector('.game-area');
const game = tictactoeBoard.getGameBoard();
gameController.playRound(2);
gameController.playRound(1);
gameController.playRound(5);
gameController.playRound(3);
gameController.playRound(8);
const updateScreen = () => {
console.log(typeof game, game);
displayBoard();
console.log('Deez nuts');
}
const displayBoard = () => {
let count = 0;
game.forEach((e) => {
e.forEach((element) => {
count += 1;
const block = document.createElement('div');
block.classList.add('block');
block.setAttribute('data-block', count);
block.textContent = element;
gameDiv.appendChild(block);
})
})
}
updateScreen();
})();