05/18/2026 Catchup - linksync project work and TicTacToe evaluations on different coding LLMs with OpenCode.
This commit is contained in:
21
TicTacToe-Compare/cogito-14b/game.js
Normal file
21
TicTacToe-Compare/cogito-14b/game.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Modern Tic Tac Toe JavaScript file
|
||||
* Copyright (c) David, 2024. */
|
||||
|
||||
// Get DOM elementsconst gridContainer = document.getElementById('board');
|
||||
const squareButtons = Array.from(document.querySelectorAll('#board button'));
|
||||
|
||||
class Game {
|
||||
constructor() {
|
||||
this.board = [
|
||||
[], [], []
|
||||
];
|
||||
this.gameOver = false;
|
||||
this.currentPlayer = '';
|
||||
this.movesCount = 0;
|
||||
// Initialize game board squares
|
||||
squareButtons.forEach(
|
||||
(btn, idx) => (
|
||||
btn.addEventListener('click', () => { if(this.moveIsValid(idx))
|
||||
this.updateBoard({cell:btn,squareIndex:idx,mark:'X'});
|
||||
else alert("Game is over");}
|
||||
))))}}
|
||||
Reference in New Issue
Block a user