Download index.html from Peaba/guppy: direct link, hf CLI and curl.
- Browser
- Download file 8.68 kB
-
https://huggingface.co/spaces/Peaba/guppy/resolve/main/index.html
- Command line
-
hf download hf://spaces/Peaba/guppy/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Peaba/guppy/resolve/main/index.html
8.68 kB
| <html lang="pt-br"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Jogo da Velha Moderno</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <style> | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: scale(0.8); } | |
| to { opacity: 1; transform: scale(1); } | |
| } | |
| .cell { | |
| transition: all 0.3s ease; | |
| } | |
| .cell:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); | |
| } | |
| .winning-cell { | |
| animation: pulse 1.5s infinite; | |
| } | |
| @keyframes pulse { | |
| 0% { transform: scale(1); } | |
| 50% { transform: scale(1.1); } | |
| 100% { transform: scale(1); } | |
| } | |
| .modal { | |
| animation: fadeIn 0.5s ease-out; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gradient-to-br from-blue-50 to-purple-50 min-h-screen flex flex-col items-center justify-center p-4"> | |
| <div class="text-center mb-8"> | |
| <h1 class="text-4xl md:text-5xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-600 to-blue-600 mb-2">Jogo da Velha</h1> | |
| <p class="text-gray-600">Jogue contra um amigo no mesmo dispositivo</p> | |
| </div> | |
| <div class="mb-6 flex items-center justify-center gap-4"> | |
| <div class="flex items-center"> | |
| <div class="w-8 h-8 rounded-full bg-purple-500 flex items-center justify-center text-white font-bold mr-2">X</div> | |
| <span class="font-medium text-gray-700">Jogador 1</span> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white font-bold mr-2">O</div> | |
| <span class="font-medium text-gray-700">Jogador 2</span> | |
| </div> | |
| </div> | |
| <div class="relative"> | |
| <div class="grid grid-cols-3 gap-4 bg-white p-6 rounded-xl shadow-xl"> | |
| <!-- As células serão geradas pelo JavaScript --> | |
| </div> | |
| <div class="absolute -bottom-6 left-1/2 transform -translate-x-1/2"> | |
| <button id="resetBtn" class="bg-gradient-to-r from-purple-500 to-blue-500 text-white px-6 py-2 rounded-full shadow-md hover:shadow-lg transition-all duration-300 transform hover:scale-105"> | |
| Reiniciar Jogo | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Modal de vitória --> | |
| <div id="winModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden modal"> | |
| <div class="bg-white p-8 rounded-xl max-w-md w-full mx-4 text-center"> | |
| <h2 class="text-2xl font-bold mb-4" id="winMessage">Jogador X venceu!</h2> | |
| <button id="playAgainBtn" class="bg-gradient-to-r from-purple-500 to-blue-500 text-white px-6 py-2 rounded-full shadow-md hover:shadow-lg transition-all"> | |
| Jogar Novamente | |
| </button> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const board = document.querySelector('.grid'); | |
| const resetBtn = document.getElementById('resetBtn'); | |
| const winModal = document.getElementById('winModal'); | |
| const winMessage = document.getElementById('winMessage'); | |
| const playAgainBtn = document.getElementById('playAgainBtn'); | |
| let currentPlayer = 'X'; | |
| let gameBoard = ['', '', '', '', '', '', '', '', '']; | |
| let gameActive = true; | |
| // Cria o tabuleiro | |
| function createBoard() { | |
| board.innerHTML = ''; | |
| for (let i = 0; i < 9; i++) { | |
| const cell = document.createElement('div'); | |
| cell.classList.add('cell', 'w-20', 'h-20', 'md:w-24', 'md:h-24', 'flex', 'items-center', 'justify-center', 'text-4xl', 'font-bold', 'rounded-lg', 'cursor-pointer', 'bg-gray-50', 'hover:bg-gray-100'); | |
| cell.setAttribute('data-index', i); | |
| cell.addEventListener('click', handleCellClick); | |
| board.appendChild(cell); | |
| } | |
| } | |
| // Manipula o clique na célula | |
| function handleCellClick(e) { | |
| const index = e.target.getAttribute('data-index'); | |
| if (gameBoard[index] !== '' || !gameActive) return; | |
| gameBoard[index] = currentPlayer; | |
| e.target.textContent = currentPlayer; | |
| e.target.classList.add(currentPlayer === 'X' ? 'text-purple-500' : 'text-blue-500'); | |
| if (checkWinner()) { | |
| gameActive = false; | |
| highlightWinningCells(); | |
| showWinner(currentPlayer); | |
| return; | |
| } | |
| if (checkDraw()) { | |
| gameActive = false; | |
| showDraw(); | |
| return; | |
| } | |
| currentPlayer = currentPlayer === 'X' ? 'O' : 'X'; | |
| } | |
| // Verifica se há um vencedor | |
| function checkWinner() { | |
| const winningCombinations = [ | |
| [0, 1, 2], [3, 4, 5], [6, 7, 8], // linhas | |
| [0, 3, 6], [1, 4, 7], [2, 5, 8], // colunas | |
| [0, 4, 8], [2, 4, 6] // diagonais | |
| ]; | |
| return winningCombinations.some(combination => { | |
| const [a, b, c] = combination; | |
| return gameBoard[a] && gameBoard[a] === gameBoard[b] && gameBoard[a] === gameBoard[c]; | |
| }); | |
| } | |
| // Destaca as células vencedoras | |
| function highlightWinningCells() { | |
| const winningCombinations = [ | |
| [0, 1, 2], [3, 4, 5], [6, 7, 8], | |
| [0, 3, 6], [1, 4, 7], [2, 5, 8], | |
| [0, 4, 8], [2, 4, 6] | |
| ]; | |
| winningCombinations.forEach(combination => { | |
| const [a, b, c] = combination; | |
| if (gameBoard[a] && gameBoard[a] === gameBoard[b] && gameBoard[a] === gameBoard[c]) { | |
| const cells = document.querySelectorAll('.cell'); | |
| cells[a].classList.add('winning-cell', 'bg-purple-100'); | |
| cells[b].classList.add('winning-cell', 'bg-purple-100'); | |
| cells[c].classList.add('winning-cell', 'bg-purple-100'); | |
| } | |
| }); | |
| } | |
| // Verifica se houve empate | |
| function checkDraw() { | |
| return gameBoard.every(cell => cell !== ''); | |
| } | |
| // Mostra o vencedor | |
| function showWinner(player) { | |
| winMessage.textContent = `Jogador ${player} venceu!`; | |
| winModal.classList.remove('hidden'); | |
| } | |
| // Mostra empate | |
| function showDraw() { | |
| winMessage.textContent = 'Empate! Ninguém venceu.'; | |
| winModal.classList.remove('hidden'); | |
| } | |
| // Reinicia o jogo | |
| function resetGame() { | |
| gameBoard = ['', '', '', '', '', '', '', '', '']; | |
| gameActive = true; | |
| currentPlayer = 'X'; | |
| createBoard(); | |
| winModal.classList.add('hidden'); | |
| } | |
| // Event listeners | |
| resetBtn.addEventListener('click', resetGame); | |
| playAgainBtn.addEventListener('click', resetGame); | |
| // Inicializa o jogo | |
| createBoard(); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Peaba/guppy" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |