JavaScript
class TicTacToe {
constructor() { this.board = Array(9).fill(null); this.currentPlayer = 'X'; }
makeMove(index) { if(!this.board[index]) { this.board[index] = this.currentPlayer; this.currentPlayer = this.currentPlayer === 'X' ? 'O' : 'X'; } }
checkWinner() { /* Check win conditions */ return null; }
}Output
// Tic-tac-toe game
Tic-Tac-Toe is a classic game implementation.