Spaces:
Running
Running
Sabse achchha typing game banao - Initial Deployment
Browse files- README.md +7 -5
- index.html +582 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: type-master
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,582 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>TypeMaster - Typing Game</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@keyframes pulse {
|
| 11 |
+
0%, 100% { transform: scale(1); }
|
| 12 |
+
50% { transform: scale(1.05); }
|
| 13 |
+
}
|
| 14 |
+
@keyframes shake {
|
| 15 |
+
0%, 100% { transform: translateX(0); }
|
| 16 |
+
25% { transform: translateX(-5px); }
|
| 17 |
+
75% { transform: translateX(5px); }
|
| 18 |
+
}
|
| 19 |
+
.pulse {
|
| 20 |
+
animation: pulse 1.5s infinite;
|
| 21 |
+
}
|
| 22 |
+
.shake {
|
| 23 |
+
animation: shake 0.3s ease-in-out;
|
| 24 |
+
}
|
| 25 |
+
.glow {
|
| 26 |
+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
|
| 27 |
+
}
|
| 28 |
+
.word-highlight {
|
| 29 |
+
background-color: rgba(96, 165, 250, 0.3);
|
| 30 |
+
border-radius: 4px;
|
| 31 |
+
padding: 2px 4px;
|
| 32 |
+
}
|
| 33 |
+
</style>
|
| 34 |
+
</head>
|
| 35 |
+
<body class="bg-gray-900 text-white min-h-screen flex flex-col">
|
| 36 |
+
<header class="bg-gray-800 py-6 px-4 shadow-lg">
|
| 37 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 38 |
+
<h1 class="text-3xl font-bold text-blue-400 flex items-center">
|
| 39 |
+
<i class="fas fa-keyboard mr-2"></i> TypeMaster
|
| 40 |
+
</h1>
|
| 41 |
+
<div id="sound-toggle" class="cursor-pointer text-xl text-blue-400 hover:text-blue-300">
|
| 42 |
+
<i class="fas fa-volume-up"></i>
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
| 45 |
+
</header>
|
| 46 |
+
|
| 47 |
+
<main class="flex-grow container mx-auto px-4 py-8 flex flex-col items-center">
|
| 48 |
+
<div class="w-full max-w-4xl">
|
| 49 |
+
<!-- Game Info Section -->
|
| 50 |
+
<section class="bg-gray-800 rounded-xl p-6 mb-8 shadow-lg">
|
| 51 |
+
<div class="flex flex-col md:flex-row justify-between items-center mb-6">
|
| 52 |
+
<div class="flex items-center space-x-4 mb-4 md:mb-0">
|
| 53 |
+
<div class="bg-blue-500 px-4 py-2 rounded-lg">
|
| 54 |
+
<span class="text-sm font-semibold">Time</span>
|
| 55 |
+
<div class="text-3xl font-bold" id="timer">60</div>
|
| 56 |
+
</div>
|
| 57 |
+
<div class="bg-purple-500 px-4 py-2 rounded-lg">
|
| 58 |
+
<span class="text-sm font-semibold">Score</span>
|
| 59 |
+
<div class="text-3xl font-bold" id="score">0</div>
|
| 60 |
+
</div>
|
| 61 |
+
<div class="bg-green-500 px-4 py-2 rounded-lg">
|
| 62 |
+
<span class="text-sm font-semibold">WPM</span>
|
| 63 |
+
<div class="text-3xl font-bold" id="wpm">0</div>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="bg-yellow-500 px-4 py-2 rounded-lg">
|
| 66 |
+
<span class="text-sm font-semibold">Accuracy</span>
|
| 67 |
+
<div class="text-3xl font-bold" id="accuracy">100%</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<div class="flex items-center space-x-4">
|
| 72 |
+
<div>
|
| 73 |
+
<label class="block text-sm font-medium mb-1" for="difficulty">Difficulty</label>
|
| 74 |
+
<select id="difficulty" class="bg-gray-700 border border-gray-600 rounded-lg px-3 py-2 text-sm focus:ring-blue-500 focus:border-blue-500">
|
| 75 |
+
<option value="easy">Easy</option>
|
| 76 |
+
<option value="medium" selected>Medium</option>
|
| 77 |
+
<option value="hard">Hard</option>
|
| 78 |
+
<option value="insane">Insane</option>
|
| 79 |
+
</select>
|
| 80 |
+
</div>
|
| 81 |
+
<button id="restart-btn" class="bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition flex items-center">
|
| 82 |
+
<i class="fas fa-redo mr-2"></i> Restart
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<div class="mb-4">
|
| 88 |
+
<div class="flex items-center justify-between">
|
| 89 |
+
<h2 class="text-lg font-semibold">Instructions</h2>
|
| 90 |
+
<span id="game-status" class="bg-blue-500 text-xs px-2 py-1 rounded-full">Ready</span>
|
| 91 |
+
</div>
|
| 92 |
+
<p class="text-gray-300 mt-1 text-sm">Type the words below as quickly and accurately as possible. The game ends when time runs out.</p>
|
| 93 |
+
</div>
|
| 94 |
+
</section>
|
| 95 |
+
|
| 96 |
+
<!-- Typing Area -->
|
| 97 |
+
<section class="relative mb-8">
|
| 98 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg">
|
| 99 |
+
<div class="mb-4 flex items-center justify-between">
|
| 100 |
+
<h2 class="text-xl font-bold text-blue-400">Your Typing Test</h2>
|
| 101 |
+
<span id="words-count" class="bg-gray-700 px-3 py-1 rounded-full text-sm">0/10 words</span>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<div id="word-display" class="bg-gray-900 text-2xl font-mono p-6 rounded-lg h-32 overflow-auto mb-4 flex flex-wrap gap-2">
|
| 105 |
+
<!-- Words will appear here -->
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<div class="relative">
|
| 109 |
+
<input type="text" id="word-input" class="w-full bg-gray-700 border-2 border-gray-600 rounded-lg py-3 px-4 text-xl focus:outline-none focus:border-blue-500 transition"
|
| 110 |
+
placeholder="Type the word here..." autocomplete="off" autofocus>
|
| 111 |
+
<div id="input-status" class="absolute right-3 top-1/2 transform -translate-y-1/2 text-xl hidden">
|
| 112 |
+
<i class="fas fa-check-circle text-green-500"></i>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<div class="mt-4 text-sm text-gray-400">
|
| 117 |
+
<span id="current-progress" class="text-blue-400 font-medium">0 characters typed</span>
|
| 118 |
+
<span id="mistakes" class="float-right text-red-400">0 mistakes</span>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
</section>
|
| 122 |
+
|
| 123 |
+
<!-- Results Section (Hidden by default) -->
|
| 124 |
+
<section id="results-section" class="hidden bg-gray-800 rounded-xl p-6 shadow-lg">
|
| 125 |
+
<h2 class="text-2xl font-bold text-center mb-6 text-blue-400">Game Results</h2>
|
| 126 |
+
|
| 127 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 128 |
+
<div class="bg-gray-900 p-6 rounded-lg text-center">
|
| 129 |
+
<div class="text-5xl font-bold text-blue-400 mb-2" id="final-score">0</div>
|
| 130 |
+
<div class="text-lg font-medium">Total Score</div>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<div class="bg-gray-900 p-6 rounded-lg text-center">
|
| 134 |
+
<div class="text-5xl font-bold text-green-400 mb-2" id="final-wpm">0</div>
|
| 135 |
+
<div class="text-lg font-medium">Words Per Minute</div>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<div class="bg-gray-900 p-6 rounded-lg text-center">
|
| 139 |
+
<div class="text-5xl font-bold text-yellow-400 mb-2" id="final-accuracy">100%</div>
|
| 140 |
+
<div class="text-lg font-medium">Accuracy</div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
|
| 144 |
+
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 145 |
+
<div class="bg-gray-900 p-4 rounded-lg">
|
| 146 |
+
<div class="mb-1 flex justify-between">
|
| 147 |
+
<span class="text-gray-400">Correct words:</span>
|
| 148 |
+
<span class="font-medium" id="correct-words">0</span>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="mb-1 flex justify-between">
|
| 151 |
+
<span class="text-gray-400">Incorrect words:</span>
|
| 152 |
+
<span class="font-medium" id="incorrect-words">0</span>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="mb-1 flex justify-between">
|
| 155 |
+
<span class="text-gray-400">Character count:</span>
|
| 156 |
+
<span class="font-medium" id="characters-typed">0</span>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<div class="bg-gray-900 p-4 rounded-lg">
|
| 161 |
+
<div class="mb-1 flex justify-between">
|
| 162 |
+
<span class="text-gray-400">Mistakes:</span>
|
| 163 |
+
<span class="font-medium" id="total-mistakes">0</span>
|
| 164 |
+
</div>
|
| 165 |
+
<div class="mb-1 flex justify-between">
|
| 166 |
+
<span class="text-gray-400">Time played:</span>
|
| 167 |
+
<span class="font-medium" id="time-played">60s</span>
|
| 168 |
+
</div>
|
| 169 |
+
<div class="mb-1 flex justify-between">
|
| 170 |
+
<span class="text-gray-400">Difficulty:</span>
|
| 171 |
+
<span class="font-medium" id="played-difficulty">Medium</span>
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<div class="mt-6 text-center">
|
| 177 |
+
<button id="play-again-btn" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-3 px-6 rounded-lg text-lg transition">
|
| 178 |
+
<i class="fas fa-play mr-2"></i> Play Again
|
| 179 |
+
</button>
|
| 180 |
+
</div>
|
| 181 |
+
</section>
|
| 182 |
+
</div>
|
| 183 |
+
</main>
|
| 184 |
+
|
| 185 |
+
<footer class="bg-gray-800 py-4 px-4 text-center text-gray-400 text-sm">
|
| 186 |
+
<p>Made with <i class="fas fa-heart text-red-500"></i> by TypeMaster | © 2023 All rights reserved</p>
|
| 187 |
+
</footer>
|
| 188 |
+
|
| 189 |
+
<script>
|
| 190 |
+
// DOM Elements
|
| 191 |
+
const wordDisplay = document.getElementById('word-display');
|
| 192 |
+
const wordInput = document.getElementById('word-input');
|
| 193 |
+
const timerDisplay = document.getElementById('timer');
|
| 194 |
+
const scoreDisplay = document.getElementById('score');
|
| 195 |
+
const wpmDisplay = document.getElementById('wpm');
|
| 196 |
+
const accuracyDisplay = document.getElementById('accuracy');
|
| 197 |
+
const wordsCountDisplay = document.getElementById('words-count');
|
| 198 |
+
const difficultySelect = document.getElementById('difficulty');
|
| 199 |
+
const restartBtn = document.getElementById('restart-btn');
|
| 200 |
+
const resultsSection = document.getElementById('results-section');
|
| 201 |
+
const gameStatus = document.getElementById('game-status');
|
| 202 |
+
const inputStatus = document.getElementById('input-status');
|
| 203 |
+
const currentProgress = document.getElementById('current-progress');
|
| 204 |
+
const mistakesDisplay = document.getElementById('mistakes');
|
| 205 |
+
const soundToggle = document.getElementById('sound-toggle');
|
| 206 |
+
const playAgainBtn = document.getElementById('play-again-btn');
|
| 207 |
+
|
| 208 |
+
// Game variables
|
| 209 |
+
let words = [];
|
| 210 |
+
let currentWordIndex = 0;
|
| 211 |
+
let score = 0;
|
| 212 |
+
let timeLeft = 60;
|
| 213 |
+
let timer;
|
| 214 |
+
let gameActive = false;
|
| 215 |
+
let correctWords = 0;
|
| 216 |
+
let incorrectWords = 0;
|
| 217 |
+
let totalCharacters = 0;
|
| 218 |
+
let correctCharacters = 0;
|
| 219 |
+
let mistakes = 0;
|
| 220 |
+
let startTime;
|
| 221 |
+
let wordCount = 10;
|
| 222 |
+
let soundEnabled = true;
|
| 223 |
+
let currentDifficulty = 'medium';
|
| 224 |
+
|
| 225 |
+
// Word banks for different difficulty levels
|
| 226 |
+
const wordBanks = {
|
| 227 |
+
easy: [
|
| 228 |
+
'cat', 'dog', 'sun', 'fun', 'run', 'big', 'red', 'blue', 'tree', 'book',
|
| 229 |
+
'ball', 'fish', 'moon', 'star', 'love', 'happy', 'beach', 'apple', 'house', 'school',
|
| 230 |
+
'water', 'music', 'smile', 'green', 'pizza', 'friend', 'summer', 'winter', 'flower', 'cloud'
|
| 231 |
+
],
|
| 232 |
+
medium: [
|
| 233 |
+
'computer', 'keyboard', 'monitor', 'internet', 'browser', 'website', 'program',
|
| 234 |
+
'network', 'digital', 'gaming', 'mobile', 'system', 'developer', 'software',
|
| 235 |
+
'hardware', 'database', 'algorithm', 'security', 'password', 'interface',
|
| 236 |
+
'graphics', 'console', 'wireless', 'function', 'virtual', 'language', 'storage',
|
| 237 |
+
'battery', 'process', 'service'
|
| 238 |
+
],
|
| 239 |
+
hard: [
|
| 240 |
+
'pneumonoultramicroscopicsilicovolcanoconiosis', 'hippopotomonstrosesquipedaliophobia',
|
| 241 |
+
'supercalifragilisticexpialidocious', 'pseudopseudohypoparathyroidism',
|
| 242 |
+
'floccinaucinihilipilification', 'antidisestablishmentarianism',
|
| 243 |
+
'honorificabilitudinitatibus', 'thyroparathyroidectomized',
|
| 244 |
+
'dichlorodifluoromethane', 'incomprehensibilities', 'uncharacteristically',
|
| 245 |
+
'counterrevolutionary', 'internationalization', 'electroencephalogram'
|
| 246 |
+
],
|
| 247 |
+
insane: [
|
| 248 |
+
'zyzzyva', 'quizzify', 'jazziness', 'pizzazz', 'huzzah', 'buzzword',
|
| 249 |
+
'fuzzbox', 'whizzbang', 'razzmatazz', 'squeezebox', 'zigzagging',
|
| 250 |
+
'syzygy', 'xylophone', 'yacht', 'sphinx', 'mnemonic', 'rhythm',
|
| 251 |
+
'fjord', 'crypt', 'gypsy', 'python', 'awkward', 'zombie', 'xenon'
|
| 252 |
+
]
|
| 253 |
+
};
|
| 254 |
+
|
| 255 |
+
// Initialize game
|
| 256 |
+
function initGame() {
|
| 257 |
+
// Reset game state
|
| 258 |
+
currentWordIndex = 0;
|
| 259 |
+
score = 0;
|
| 260 |
+
correctWords = 0;
|
| 261 |
+
incorrectWords = 0;
|
| 262 |
+
totalCharacters = 0;
|
| 263 |
+
correctCharacters = 0;
|
| 264 |
+
mistakes = 0;
|
| 265 |
+
timeLeft = 60;
|
| 266 |
+
gameActive = false;
|
| 267 |
+
|
| 268 |
+
// Update UI
|
| 269 |
+
scoreDisplay.textContent = '0';
|
| 270 |
+
wpmDisplay.textContent = '0';
|
| 271 |
+
accuracyDisplay.textContent = '100%';
|
| 272 |
+
wordsCountDisplay.textContent = '0/' + wordCount + ' words';
|
| 273 |
+
mistakesDisplay.textContent = '0 mistakes';
|
| 274 |
+
currentProgress.textContent = '0 characters typed';
|
| 275 |
+
gameStatus.textContent = 'Ready';
|
| 276 |
+
gameStatus.className = 'bg-blue-500 text-xs px-2 py-1 rounded-full';
|
| 277 |
+
|
| 278 |
+
// Generate words based on difficulty
|
| 279 |
+
currentDifficulty = difficultySelect.value;
|
| 280 |
+
const wordBank = wordBanks[currentDifficulty];
|
| 281 |
+
words = [];
|
| 282 |
+
|
| 283 |
+
for (let i = 0; i < wordCount; i++) {
|
| 284 |
+
const randomIndex = Math.floor(Math.random() * wordBank.length);
|
| 285 |
+
words.push(wordBank[randomIndex]);
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Display words
|
| 289 |
+
displayWords();
|
| 290 |
+
|
| 291 |
+
// Clear input and enable
|
| 292 |
+
wordInput.value = '';
|
| 293 |
+
wordInput.disabled = false;
|
| 294 |
+
wordInput.focus();
|
| 295 |
+
|
| 296 |
+
// Hide results
|
| 297 |
+
resultsSection.classList.add('hidden');
|
| 298 |
+
|
| 299 |
+
// Start timer when first key is pressed
|
| 300 |
+
wordInput.addEventListener('keydown', startGameOnFirstKey);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
// Start game on first key press
|
| 304 |
+
function startGameOnFirstKey(e) {
|
| 305 |
+
if (!gameActive && e.key !== 'Shift' && e.key !== 'Tab' && e.key !== 'CapsLock' && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
| 306 |
+
gameActive = true;
|
| 307 |
+
gameStatus.textContent = 'Playing';
|
| 308 |
+
gameStatus.className = 'bg-green-500 text-xs px-2 py-1 rounded-full';
|
| 309 |
+
startTimer();
|
| 310 |
+
startTime = new Date();
|
| 311 |
+
wordInput.removeEventListener('keydown', startGameOnFirstKey);
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// Display words in the word display area
|
| 316 |
+
function displayWords() {
|
| 317 |
+
wordDisplay.innerHTML = '';
|
| 318 |
+
|
| 319 |
+
words.forEach((word, index) => {
|
| 320 |
+
const wordSpan = document.createElement('span');
|
| 321 |
+
wordSpan.textContent = word;
|
| 322 |
+
|
| 323 |
+
if (index === currentWordIndex) {
|
| 324 |
+
wordSpan.className = 'word-highlight text-yellow-400';
|
| 325 |
+
} else if (index < currentWordIndex) {
|
| 326 |
+
wordSpan.className = 'text-green-400';
|
| 327 |
+
} else {
|
| 328 |
+
wordSpan.className = 'text-white';
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
wordDisplay.appendChild(wordSpan);
|
| 332 |
+
|
| 333 |
+
// Add space between words but not after last word
|
| 334 |
+
if (index < words.length - 1) {
|
| 335 |
+
const spaceSpan = document.createElement('span');
|
| 336 |
+
spaceSpan.textContent = ' ';
|
| 337 |
+
wordDisplay.appendChild(spaceSpan);
|
| 338 |
+
}
|
| 339 |
+
});
|
| 340 |
+
|
| 341 |
+
// Update words count
|
| 342 |
+
wordsCountDisplay.textContent = currentWordIndex + '/' + wordCount + ' words';
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Start timer
|
| 346 |
+
function startTimer() {
|
| 347 |
+
timer = setInterval(() => {
|
| 348 |
+
timeLeft--;
|
| 349 |
+
timerDisplay.textContent = timeLeft;
|
| 350 |
+
|
| 351 |
+
if (timeLeft <= 10) {
|
| 352 |
+
timerDisplay.classList.add('text-red-500', 'pulse');
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
if (timeLeft <= 0) {
|
| 356 |
+
endGame();
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
// Update WPM every second
|
| 360 |
+
updateWPM();
|
| 361 |
+
}, 1000);
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
// Update Words Per Minute
|
| 365 |
+
function updateWPM() {
|
| 366 |
+
if (correctWords === 0 || !startTime) return;
|
| 367 |
+
|
| 368 |
+
const now = new Date();
|
| 369 |
+
const timeElapsed = (now - startTime) / 1000 / 60; // in minutes
|
| 370 |
+
const wpm = Math.round(correctWords / timeElapsed);
|
| 371 |
+
wpmDisplay.textContent = wpm;
|
| 372 |
+
|
| 373 |
+
// Update accuracy
|
| 374 |
+
const accuracy = totalCharacters > 0 ? Math.round((correctCharacters / totalCharacters) * 100) : 100;
|
| 375 |
+
accuracyDisplay.textContent = accuracy + '%';
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
// Handle word input
|
| 379 |
+
wordInput.addEventListener('input', (e) => {
|
| 380 |
+
const inputText = wordInput.value.trim();
|
| 381 |
+
const currentWord = words[currentWordIndex];
|
| 382 |
+
|
| 383 |
+
totalCharacters = inputText.length;
|
| 384 |
+
currentProgress.textContent = totalCharacters + ' characters typed';
|
| 385 |
+
|
| 386 |
+
// Check if word is complete
|
| 387 |
+
if (inputText === currentWord) {
|
| 388 |
+
handleCorrectWord();
|
| 389 |
+
}
|
| 390 |
+
});
|
| 391 |
+
|
| 392 |
+
wordInput.addEventListener('keydown', (e) => {
|
| 393 |
+
if (e.key === ' ') {
|
| 394 |
+
e.preventDefault();
|
| 395 |
+
checkCurrentWord();
|
| 396 |
+
} else if (e.key === 'Enter') {
|
| 397 |
+
e.preventDefault();
|
| 398 |
+
checkCurrentWord();
|
| 399 |
+
}
|
| 400 |
+
});
|
| 401 |
+
|
| 402 |
+
// Check if current word matches input
|
| 403 |
+
function checkCurrentWord() {
|
| 404 |
+
const inputText = wordInput.value.trim();
|
| 405 |
+
const currentWord = words[currentWordIndex];
|
| 406 |
+
|
| 407 |
+
if (inputText === currentWord) {
|
| 408 |
+
handleCorrectWord();
|
| 409 |
+
} else {
|
| 410 |
+
handleIncorrectWord();
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
// Handle correct word
|
| 415 |
+
function handleCorrectWord() {
|
| 416 |
+
if (soundEnabled) {
|
| 417 |
+
playSound('correct');
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
// Update stats
|
| 421 |
+
correctWords++;
|
| 422 |
+
correctCharacters += words[currentWordIndex].length;
|
| 423 |
+
|
| 424 |
+
// Calculate score (based on word length and speed)
|
| 425 |
+
const wordScore = words[currentWordIndex].length * 5;
|
| 426 |
+
score += wordScore;
|
| 427 |
+
|
| 428 |
+
// Animate UI
|
| 429 |
+
inputStatus.innerHTML = '<i class="fas fa-check-circle text-green-500"></i>';
|
| 430 |
+
inputStatus.classList.remove('hidden');
|
| 431 |
+
scoreDisplay.textContent = score;
|
| 432 |
+
scoreDisplay.classList.add('glow');
|
| 433 |
+
|
| 434 |
+
setTimeout(() => {
|
| 435 |
+
inputStatus.classList.add('hidden');
|
| 436 |
+
scoreDisplay.classList.remove('glow');
|
| 437 |
+
}, 500);
|
| 438 |
+
|
| 439 |
+
// Move to next word
|
| 440 |
+
moveToNextWord();
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// Handle incorrect word
|
| 444 |
+
function handleIncorrectWord() {
|
| 445 |
+
if (soundEnabled) {
|
| 446 |
+
playSound('incorrect');
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
// Update stats
|
| 450 |
+
incorrectWords++;
|
| 451 |
+
mistakes++;
|
| 452 |
+
mistakesDisplay.textContent = mistakes + ' mistakes';
|
| 453 |
+
|
| 454 |
+
// Animate UI
|
| 455 |
+
wordInput.classList.add('shake', 'border-red-500');
|
| 456 |
+
inputStatus.innerHTML = '<i class="fas fa-times-circle text-red-500"></i>';
|
| 457 |
+
inputStatus.classList.remove('hidden');
|
| 458 |
+
|
| 459 |
+
setTimeout(() => {
|
| 460 |
+
wordInput.classList.remove('shake', 'border-red-500');
|
| 461 |
+
inputStatus.classList.add('hidden');
|
| 462 |
+
}, 500);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// Move to next word or end game if all words are done
|
| 466 |
+
function moveToNextWord() {
|
| 467 |
+
currentWordIndex++;
|
| 468 |
+
wordInput.value = '';
|
| 469 |
+
|
| 470 |
+
// Update progress
|
| 471 |
+
currentProgress.textContent = '0 characters typed';
|
| 472 |
+
|
| 473 |
+
if (currentWordIndex >= words.length) {
|
| 474 |
+
// All words completed before time ran out
|
| 475 |
+
if (gameActive) {
|
| 476 |
+
wordCount += 5; // Increase word count for next round
|
| 477 |
+
initGame(); // Start new round with more words
|
| 478 |
+
}
|
| 479 |
+
} else {
|
| 480 |
+
displayWords();
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
// End game
|
| 485 |
+
function endGame() {
|
| 486 |
+
clearInterval(timer);
|
| 487 |
+
gameActive = false;
|
| 488 |
+
|
| 489 |
+
// Disable input
|
| 490 |
+
wordInput.disabled = true;
|
| 491 |
+
|
| 492 |
+
// Update game status
|
| 493 |
+
gameStatus.textContent = 'Finished';
|
| 494 |
+
gameStatus.className = 'bg-red-500 text-xs px-2 py-1 rounded-full';
|
| 495 |
+
|
| 496 |
+
// Calculate final stats
|
| 497 |
+
const now = new Date();
|
| 498 |
+
const timePlayedInMinutes = (now - startTime) / 1000 / 60;
|
| 499 |
+
const finalWPM = Math.round(correctWords / timePlayedInMinutes);
|
| 500 |
+
const finalAccuracy = totalCharacters > 0 ? Math.round((correctCharacters / totalCharacters) * 100) : 100;
|
| 501 |
+
|
| 502 |
+
// Show results
|
| 503 |
+
document.getElementById('final-score').textContent = score;
|
| 504 |
+
document.getElementById('final-wpm').textContent = finalWPM;
|
| 505 |
+
document.getElementById('final-accuracy').textContent = finalAccuracy + '%';
|
| 506 |
+
document.getElementById('correct-words').textContent = correctWords;
|
| 507 |
+
document.getElementById('incorrect-words').textContent = incorrectWords;
|
| 508 |
+
document.getElementById('characters-typed').textContent = totalCharacters;
|
| 509 |
+
document.getElementById('total-mistakes').textContent = mistakes;
|
| 510 |
+
document.getElementById('time-played').textContent = Math.round((60 - timeLeft) * 10) / 10 + 's';
|
| 511 |
+
document.getElementById('played-difficulty').textContent = currentDifficulty.charAt(0).toUpperCase() + currentDifficulty.slice(1);
|
| 512 |
+
|
| 513 |
+
resultsSection.classList.remove('hidden');
|
| 514 |
+
|
| 515 |
+
// Scroll to results
|
| 516 |
+
resultsSection.scrollIntoView({ behavior: 'smooth' });
|
| 517 |
+
|
| 518 |
+
if (soundEnabled) {
|
| 519 |
+
playSound('gameover');
|
| 520 |
+
}
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
// Play sound
|
| 524 |
+
function playSound(type) {
|
| 525 |
+
if (!soundEnabled) return;
|
| 526 |
+
|
| 527 |
+
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
| 528 |
+
const oscillator = audioContext.createOscillator();
|
| 529 |
+
const gainNode = audioContext.createGain();
|
| 530 |
+
|
| 531 |
+
oscillator.connect(gainNode);
|
| 532 |
+
gainNode.connect(audioContext.destination);
|
| 533 |
+
|
| 534 |
+
switch(type) {
|
| 535 |
+
case 'correct':
|
| 536 |
+
oscillator.frequency.value = 880;
|
| 537 |
+
oscillator.type = 'sine';
|
| 538 |
+
break;
|
| 539 |
+
case 'incorrect':
|
| 540 |
+
oscillator.frequency.value = 220;
|
| 541 |
+
oscillator.type = 'square';
|
| 542 |
+
break;
|
| 543 |
+
case 'gameover':
|
| 544 |
+
oscillator.frequency.setValueAtTime(440, audioContext.currentTime);
|
| 545 |
+
oscillator.frequency.exponentialRampToValueAtTime(55, audioContext.currentTime + 0.5);
|
| 546 |
+
oscillator.type = 'sawtooth';
|
| 547 |
+
break;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
gainNode.gain.exponentialRampToValueAtTime(0.00001, audioContext.currentTime + 0.3);
|
| 551 |
+
oscillator.start();
|
| 552 |
+
oscillator.stop(audioContext.currentTime + 0.3);
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
// Event listeners
|
| 556 |
+
restartBtn.addEventListener('click', initGame);
|
| 557 |
+
playAgainBtn.addEventListener('click', initGame);
|
| 558 |
+
|
| 559 |
+
difficultySelect.addEventListener('change', () => {
|
| 560 |
+
if (!gameActive) {
|
| 561 |
+
initGame();
|
| 562 |
+
}
|
| 563 |
+
});
|
| 564 |
+
|
| 565 |
+
soundToggle.addEventListener('click', () => {
|
| 566 |
+
soundEnabled = !soundEnabled;
|
| 567 |
+
if (soundEnabled) {
|
| 568 |
+
soundToggle.innerHTML = '<i class="fas fa-volume-up"></i>';
|
| 569 |
+
soundToggle.classList.add('text-blue-400');
|
| 570 |
+
soundToggle.classList.remove('text-gray-500');
|
| 571 |
+
} else {
|
| 572 |
+
soundToggle.innerHTML = '<i class="fas fa-volume-mute"></i>';
|
| 573 |
+
soundToggle.classList.remove('text-blue-400');
|
| 574 |
+
soundToggle.classList.add('text-gray-500');
|
| 575 |
+
}
|
| 576 |
+
});
|
| 577 |
+
|
| 578 |
+
// Initialize game on load
|
| 579 |
+
document.addEventListener('DOMContentLoaded', initGame);
|
| 580 |
+
</script>
|
| 581 |
+
<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=A3qualityo/type-master" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 582 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Sabse achchha typing game banao
|