Soduko
Soduko
DOCTYpE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sudoku Game</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
margin: 50px;
background-color: #f4f4f4;
}
h1 {
color: #333;
}
#sudoku-board {
display: grid;
grid-template-columns: repeat(9, 1fr);
grid-gap: 2px;
max-width: 400px;
margin: 0 auto;
}
.cell {
width: 100%;
height: 50px;
font-size: 20px;
box-sizing: border-box;
border: 1px solid #ddd;
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.cell.input {
cursor: pointer;
}
.cell.input:hover {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>Sudoku Game</h1>
<div id="sudoku-board"></div>
<script>
// Function to generate a random Sudoku puzzle
function generateSudoku() {
const sudokuBoard = [];
for (let i = 0; i < 9; i++) {
const row = [];
for (let j = 0; j < 9; j++) {
row.push(0); // Initialize with zeros
}
sudokuBoard.push(row);
}
return sudokuBoard;
}
if (solveSudoku(board)) {
return true;
}
if (board[i][j] !== 0) {
board[i][j] = 0;
removedCount++;
}
}
}
sudokuBoardElement.appendChild(cellElement);
}
}
}