Play Gomoku against an AI opponent. The player is black and AI is white.
Prompt
create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.create a Gomoku game that player play with AI (PC). player is black, AI is white.
HTML
<div id="gomoku"> <div id="message"></div> <div id="board"></div> </div>
CSS
#gomoku {
max-width: 500px;
margin: 50px auto;
}
#board {
display: grid;
grid-template-columns: repeat(15, 1fr);
gap: 1px;
background-color: #333;
}
.cell {
width: 30px;
height: 30px;
background-color: #f0d9b5;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
cursor: pointer;
}
.cell.black::after {
content: "●";
color: black;
}
.cell.white::after {
content: "○";
color: white;
}JS
(function() {
const size = 15;
const board = [];
let currentPlayer = 'black';
const message = document.getElementById('message');
const boardDiv = document.getElementById('board');
function initBoard() {
boardDiv.style.gridTemplateColumns = `repeat(${size}, 1fr)`;
for (let i = 0; i < size * size; i++) {
const cell = document.createElement('div');
cell.classList.add('cell');
cell.addEventListener('click', () => handlePlayerMove(i));
boardDiv.appendChild(cell);
board[i] = '';
}
}
function handlePlayerMove(index) {
if (board[index]) return;
board[index] = 'black';
updateBoard();
if (!checkWin('black')) aiMove();
}
function aiMove() {
const availableMoves = board.map((v, i) => v === '' ? i : -1).filter(i => i !== -1);
const move = availableMoves[Math.floor(Math.random() * availableMoves.length)];
board[move] = 'white';
updateBoard();
if (checkWin('white')) currentPlayer = 'none';
}
function updateBoard() {
board.forEach((value, index) => {
const cell = boardDiv.children[index];
cell.classList.remove('black', 'white');
if (value) cell.classList.add(value);
});
}
function checkWin(player) {
const inARow = 5;
// Check horizontal, vertical, and diagonal lines
for (let row = 0; row < size; row++) {
for (let col = 0; col < size; col++) {
if (
checkLine(row, col, 1, 0, player) ||
checkLine(row, col, 0, 1, player) ||
checkLine(row, col, 1, 1, player) ||
checkLine(row, col, 1, -1, player)
) {
message.textContent = `${player.charAt(0).toUpperCase() + player.slice(1)} wins!`;
return true;
}
}
}
return false;
}
function checkLine(row, col, dRow, dCol, player) {
let count = 0;
for (let i = 0; i < 5; i++) {
const r = row + i * dRow;
const c = col + i * dCol;
if (r >= 0 && r < size && c >= 0 && c < size && board[r * size + c] === player) {
count++;
} else break;
}
return count === 5;
}
initBoard();
})();Comments (0)
Log in to comment.
Working...