From 42f39506fdfb8fed73465381acde35b14a2a28bf Mon Sep 17 00:00:00 2001 From: Bhargav-ram333 Date: Wed, 15 Oct 2025 23:35:36 +0530 Subject: [PATCH 1/3] initial commmit --- .DS_Store | Bin 0 -> 8196 bytes DT | 1 + 2 files changed, 1 insertion(+) create mode 100644 .DS_Store create mode 160000 DT diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0969e71bfc1bf431a231e775507c732fa3cc1bad GIT binary patch literal 8196 zcmeHLTWl0n7(U;$lv(P~DHkn_3oFZ|!4leX(NZqkc0sNd*=@TmVA+~^CnMm?h9?$hZzVn@W0Fe-ydT1aGD6{xS;;lL7jgEAX-Uc zztLFb1ER5jCIUJxC~2rcxDpkv2(B0q?j(-|c8P$F3o6_hg3AYjl@Z)f;IB^e$9!{! zgrH#`W+2SK)fwPrBe5h)=SJM&EAQ{F*Vy9RERnz6^a<#laHRz0_ysTGr+p~qe zoJ%{7l`D_4xo*=K=~w4;IJTEHZKL2jn7TnG`+7`UcShQsqOH5WZ%QcSh#cux>&C{K zTACYTt5&T&+7KISX>M$Yt)}tOh&(sGvUN}YA#2EXj)~Vtumvz>QaBHnW3dLBQh8@+ zSm^Jcaarz`Iz)^WN&bz3$M{7##>kB78Z5lFV)mV7cITDam~7o z9e3>Lyr9<3nmuQ(qV!RUZO=St8ilSAQ}+gYvu@t7b<-Z`DVeUBvy8Nz9WrXs5Q+F+ z^X6+>rkFGDDVpA4H7?7(biqPR*{9Q+?{aiLo35Ucg?)UXrtRgLj)FnG9ylzk*OatN z`B1ZgVZ#bVNgpB%sBW-SQ?sIVS=pRnsd_}Lv-UPc>nVxo)E$Aab*`di=*JwQP~1Sa zDWPe1^JRBtU9WT4u<4b~25Tot*XIsq3r6P%VK9(xC8_^QlAJqj)=keTD|b>9y?nYh zUH4;{T{}zF?$T1SdS0gA&$LS>;hu6X;4jBT;u(v?6U)Uoe#RU1M}9`i;teXw8G4=pE&Q7qC>>c(#JI6j}->@IqFYGr|p&Bz$0~PbI2#c`uaeU0tjZm2~4xb+_>HYT4L+8HobAWwc&d13vI4l#361 z9~YBAdx7fh=I8a$UYC>pQ^8_N4c0LE`43N3bAS(zyEKZ`uqQN zdAD%UFau!*u1y9|nM@_yX|1XDCVtnB(Q|+v-niYkpuP)r6FvkGA6& Date: Wed, 15 Oct 2025 23:37:38 +0530 Subject: [PATCH 2/3] initial commmit --- .DS_Store | Bin 8196 -> 6148 bytes DT | 1 - TYPING GAME/index.html | 40 +++++++++++ TYPING GAME/script.js | 153 +++++++++++++++++++++++++++++++++++++++++ TYPING GAME/style.css | 126 +++++++++++++++++++++++++++++++++ 5 files changed, 319 insertions(+), 1 deletion(-) delete mode 160000 DT create mode 100644 TYPING GAME/index.html create mode 100644 TYPING GAME/script.js create mode 100644 TYPING GAME/style.css diff --git a/.DS_Store b/.DS_Store index 0969e71bfc1bf431a231e775507c732fa3cc1bad..74aaa2b07be9c86f70520e66b892d95f95faa4bb 100644 GIT binary patch delta 362 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50D9Q$s2aEYJxHBjKu_J@;#=_-{ z(jXabh7g8Gh5!an1|(Sq*U2IR$Ln#(<)j-1C+FuD0CmFv4wbq2E-pzq`AI-!9GM<} zC3ypmI|A7_Ri~h+_Q0>aAcI(EOfD3kwy|L^^I~=m4nby!n+3Rmv@0l>HWq$op3E=f X2nt6~K(T;mCP+Yn#Wu(D%wYxqN^m+r literal 8196 zcmeHLTWl0n7(U;$lv(P~DHkn_3oFZ|!4leX(NZqkc0sNd*=@TmVA+~^CnMm?h9?$hZzVn@W0Fe-ydT1aGD6{xS;;lL7jgEAX-Uc zztLFb1ER5jCIUJxC~2rcxDpkv2(B0q?j(-|c8P$F3o6_hg3AYjl@Z)f;IB^e$9!{! zgrH#`W+2SK)fwPrBe5h)=SJM&EAQ{F*Vy9RERnz6^a<#laHRz0_ysTGr+p~qe zoJ%{7l`D_4xo*=K=~w4;IJTEHZKL2jn7TnG`+7`UcShQsqOH5WZ%QcSh#cux>&C{K zTACYTt5&T&+7KISX>M$Yt)}tOh&(sGvUN}YA#2EXj)~Vtumvz>QaBHnW3dLBQh8@+ zSm^Jcaarz`Iz)^WN&bz3$M{7##>kB78Z5lFV)mV7cITDam~7o z9e3>Lyr9<3nmuQ(qV!RUZO=St8ilSAQ}+gYvu@t7b<-Z`DVeUBvy8Nz9WrXs5Q+F+ z^X6+>rkFGDDVpA4H7?7(biqPR*{9Q+?{aiLo35Ucg?)UXrtRgLj)FnG9ylzk*OatN z`B1ZgVZ#bVNgpB%sBW-SQ?sIVS=pRnsd_}Lv-UPc>nVxo)E$Aab*`di=*JwQP~1Sa zDWPe1^JRBtU9WT4u<4b~25Tot*XIsq3r6P%VK9(xC8_^QlAJqj)=keTD|b>9y?nYh zUH4;{T{}zF?$T1SdS0gA&$LS>;hu6X;4jBT;u(v?6U)Uoe#RU1M}9`i;teXw8G4=pE&Q7qC>>c(#JI6j}->@IqFYGr|p&Bz$0~PbI2#c`uaeU0tjZm2~4xb+_>HYT4L+8HobAWwc&d13vI4l#361 z9~YBAdx7fh=I8a$UYC>pQ^8_N4c0LE`43N3bAS(zyEKZ`uqQN zdAD%UFau!*u1y9|nM@_yX|1XDCVtnB(Q|+v-niYkpuP)r6FvkGA6& + + + + + Typing Game + + + +

Typing Game!

+

Practice your typing skills with a quote from Sherlock Holmes. Click Start to begin!

+ + +

+

+ +
+ + +
+ + +

Time: 0s

+

+ + + + + + + diff --git a/TYPING GAME/script.js b/TYPING GAME/script.js new file mode 100644 index 0000000..4849f10 --- /dev/null +++ b/TYPING GAME/script.js @@ -0,0 +1,153 @@ +// All quotes +const quotes = [ + 'When you have eliminated the impossible, whatever remains, however improbable, must be the truth.', + 'There is nothing more deceptive than an obvious fact.', + 'I ought to know by this time that when a fact appears to be opposed to a long train of deductions it invariably proves to be capable of bearing some other interpretation.', + 'I never make exceptions. An exception disproves the rule.', + 'What one man can invent another can discover.', + 'Nothing clears up a case so much as stating it to another person.', + 'Education never ends, Watson. It is a series of lessons, with the greatest for the last.', +]; + +// Game variables +let words = []; +let wordIndex = 0; +let startTime = 0; +let timerInterval; +let highScore = localStorage.getItem('highScore'); + +// Page elements +const quoteElement = document.getElementById('quote'); +const messageElement = document.getElementById('message'); +const typedValueElement = document.getElementById('typed-value'); +const startButton = document.getElementById('start'); +const timerElement = document.getElementById('timer'); +const highScoreElement = document.getElementById('high-score'); + +// Modal elements +const modal = document.getElementById('successModal'); +const closeBtn = document.querySelector('.close'); +const finalTime = document.getElementById('finalTime'); +const bestScoreMsg = document.getElementById('bestScoreMsg'); +const playAgainBtn = document.getElementById('playAgainBtn'); + +// Show existing high score +if (highScore) { + highScoreElement.textContent = `Best Time: ${highScore}s`; +} + +// Start button click event +startButton.addEventListener('click', () => { + // Pick a random quote + const quoteIndex = Math.floor(Math.random() * quotes.length); + const quote = quotes[quoteIndex]; + + // Split into words + words = quote.split(' '); + wordIndex = 0; + + // Display words with span tags + const spanWords = words.map(word => `${word} `); + quoteElement.innerHTML = spanWords.join(''); + + // Highlight first word + quoteElement.childNodes[0].className = 'highlight'; + messageElement.innerText = ''; + + // Reset and enable typing box + typedValueElement.value = ''; + typedValueElement.disabled = false; + typedValueElement.focus(); + typedValueElement.className = ''; + + // Enable input listener + typedValueElement.addEventListener('input', checkInput); + + // Reset and start timer + clearInterval(timerInterval); + startTime = Date.now(); + timerElement.textContent = 'Time: 0s'; + timerInterval = setInterval(updateTimer, 1000); +}); + +// Update timer every second +function updateTimer() { + const elapsed = Math.floor((Date.now() - startTime) / 1000); + timerElement.textContent = `Time: ${elapsed}s`; +} + +// Input checking function +function checkInput() { + const currentWord = words[wordIndex]; + const typedValue = typedValueElement.value; + + if (typedValue === currentWord && wordIndex === words.length - 1) { + // End of quote + clearInterval(timerInterval); + const totalTime = Math.floor((Date.now() - startTime) / 1000); + + // Disable typing and input listener + typedValueElement.disabled = true; + typedValueElement.removeEventListener('input', checkInput); + + // Show modal + showSuccessModal(totalTime); + + } else if (typedValue.endsWith(' ') && typedValue.trim() === currentWord) { + // Correct word typed + typedValueElement.value = ''; + wordIndex++; + for (const wordElement of quoteElement.childNodes) { + wordElement.className = ''; + } + quoteElement.childNodes[wordIndex].className = 'highlight'; + } else if (currentWord.startsWith(typedValue)) { + // Correct so far + typedValueElement.className = ''; + } else { + // Error + typedValueElement.className = 'error'; + } +} + +// Success modal logic +function showSuccessModal(timeTaken) { + modal.style.display = 'block'; + finalTime.textContent = `Your Time: ${timeTaken}s`; + + if (!highScore || timeTaken < highScore) { + localStorage.setItem('highScore', timeTaken); + bestScoreMsg.textContent = 'New High Score!'; + highScoreElement.textContent = `Best Time: ${timeTaken}s`; + } else { + bestScoreMsg.textContent = `Best Time to Beat: ${highScore}s`; + } +} + +// Close or restart game +closeBtn.onclick = () => { + modal.style.display = 'none'; + resetGame(); +}; + +playAgainBtn.onclick = () => { + modal.style.display = 'none'; + resetGame(); +}; + +window.onclick = (event) => { + if (event.target === modal) { + modal.style.display = 'none'; + resetGame(); + } +}; + +// Reset to initial state +function resetGame() { + startButton.disabled = false; + typedValueElement.disabled = true; + quoteElement.innerHTML = ''; + timerElement.textContent = 'Time: 0s'; + messageElement.textContent = ''; + typedValueElement.className = ''; +} diff --git a/TYPING GAME/style.css b/TYPING GAME/style.css new file mode 100644 index 0000000..360e975 --- /dev/null +++ b/TYPING GAME/style.css @@ -0,0 +1,126 @@ +/* General Page Styling */ +body { + font-family: Arial, sans-serif; + background-color: #f7f7f7; + text-align: center; + margin: 0; + padding: 40px; +} + +h1 { + color: #333; + margin-bottom: 10px; +} + +p { + color: #555; + font-size: 1.1em; +} + +/* Quote Display */ +#quote { + font-size: 1.3em; + margin: 20px auto; + max-width: 600px; + color: #222; +} + +/* Typing Input */ +#typed-value { + width: 60%; + padding: 10px; + font-size: 1em; + margin-top: 10px; + border: 1px solid #ccc; + border-radius: 5px; +} + +/* Start Button */ +#start { + margin-left: 10px; + padding: 10px 20px; + font-size: 1em; + background-color: #007bff; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; + transition: background 0.3s; +} + +#start:hover { + background-color: #0056b3; +} + +/* Highlight and Error */ +.highlight { + background-color: yellow; +} + +.error { + background-color: lightcoral; + border: 1px solid red; +} + +/* Timer and High Score */ +#timer, #high-score { + font-weight: bold; + margin-top: 20px; + color: #444; +} + +/* Modal Styles */ +.modal { + display: none; /* Hidden by default */ + position: fixed; + z-index: 1000; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0,0,0,0.5); /* Dark overlay */ +} + +.modal-content { + background-color: white; + margin: 15% auto; + padding: 20px; + border-radius: 10px; + width: 80%; + max-width: 400px; + text-align: center; + box-shadow: 0 5px 15px rgba(0,0,0,0.3); + animation: fadeIn 0.4s ease-in; +} + +@keyframes fadeIn { + from { opacity: 0; transform: translateY(-10px); } + to { opacity: 1; transform: translateY(0); } +} + +.close { + color: #aaa; + float: right; + font-size: 22px; + font-weight: bold; + cursor: pointer; +} + +.close:hover { + color: black; +} + +#playAgainBtn { + margin-top: 15px; + padding: 10px 20px; + background-color: #28a745; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +#playAgainBtn:hover { + background-color: #218838; +} From 25a1da6fd7d7594fda45a458c7dc41fa7c2fef6b Mon Sep 17 00:00:00 2001 From: Bhargav-ram333 Date: Thu, 16 Oct 2025 01:07:22 +0530 Subject: [PATCH 3/3] changed the code --- .DS_Store | Bin 6148 -> 10244 bytes TYPING GAME/.DS_Store | Bin 0 -> 6148 bytes TYPING GAME/index.html | 33 ++++----- TYPING GAME/script.js | 158 ++++++++++++++--------------------------- TYPING GAME/style.css | 140 ++++++++++++++---------------------- 5 files changed, 122 insertions(+), 209 deletions(-) create mode 100644 TYPING GAME/.DS_Store diff --git a/.DS_Store b/.DS_Store index 74aaa2b07be9c86f70520e66b892d95f95faa4bb..756398856591ec55a5098d453360d1055fb5e379 100644 GIT binary patch literal 10244 zcmeHNYitx%6u#%S(3zHzDW%fFEG%q*0!8}5P!Qa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)75I1cy01Mnc6 zfJfm;cp9F8XW<2S1zv;K;SG2fK7xXv%0Bp!Y- zpD}M?_0@}NmakgZu(5Sp?0kgskS;{=h1~E6F@r`PA-sT@70fIumC#ZtT#Tc8kxBZb zz(_5ZaqEb*Qa~ojb9l8*S}P!jhYN==~_5xFUs@ap=|CQ*=qSGGu7 zMP#X5I;|iLu3suiGC|IIQ|bt97m#W4C7{69Sa1x$FBD@GMAq`H! zoA4H#hWFtNeCQM68>GXJ@YAdi-#shDS?CuD@r>Qk;eT=kW5@5cQr~-Re`l@z2kY^% zfBV79$Fr7cTcbE~fu=K;5Yz$$0t5mC0t5mC0tBvD1WNeK!|eXQv-t1-SM2(Ni3bP- z2>dewP}&jih@oAvzxLT(dl=J=nApSYrnvN6F!QeCQF_<$SYh{yb(ol~f8*qpqrPs6 jOV1r`Ja?4*Hvf|U7;rh=!v*L6;Qa6Z%UtLGc>ezrx17{h delta 117 zcmZn(XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50$jG)aU^gQp+vIw2sm*Ev9E_W1 zir-{e%+A3f$P82l1OnVZ!WE=rW8rt^$^0sgAR`$V85meVG!w*3u-N8!o;l0_dq@$n diff --git a/TYPING GAME/.DS_Store b/TYPING GAME/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 +

Typing Game!

-

Practice your typing skills with a quote from Sherlock Holmes. Click Start to begin!

- - -

-

+

Practice your typing skills with a quote from Sherlock Holmes. Click Start to begin!

+

+

+
- - + +
- -

Time: 0s

-

+

Best Time: --

- -