From 862b73a5a382932f48229830a1ee9cadbf37cd5c Mon Sep 17 00:00:00 2001
From: Ankit Kumar <139707943+ankit071105@users.noreply.github.com>
Date: Sat, 10 Aug 2024 08:52:37 +0530
Subject: [PATCH] Add files via upload
Added Speaking Number By Guessing As per it has been assigned me
---
Games/Speaking Number Guessings/index.html | 23 +++++
Games/Speaking Number Guessings/manifest.json | 26 ++++++
Games/Speaking Number Guessings/script.js | 56 ++++++++++++
Games/Speaking Number Guessings/style.css | 85 +++++++++++++++++++
4 files changed, 190 insertions(+)
create mode 100644 Games/Speaking Number Guessings/index.html
create mode 100644 Games/Speaking Number Guessings/manifest.json
create mode 100644 Games/Speaking Number Guessings/script.js
create mode 100644 Games/Speaking Number Guessings/style.css
diff --git a/Games/Speaking Number Guessings/index.html b/Games/Speaking Number Guessings/index.html
new file mode 100644
index 0000000000..2106e7db3d
--- /dev/null
+++ b/Games/Speaking Number Guessings/index.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ Speak Number Guess
+
+
+
+
Guess a Number Between 1 - 100
+
Speak the number into your microphone
+
+
+
+
+
diff --git a/Games/Speaking Number Guessings/manifest.json b/Games/Speaking Number Guessings/manifest.json
new file mode 100644
index 0000000000..336489e115
--- /dev/null
+++ b/Games/Speaking Number Guessings/manifest.json
@@ -0,0 +1,26 @@
+{
+ "name": "Speak Number Guess",
+ "short_name": "Num Guess",
+ "description": "A game where you guess a number between 1 and 100 by speaking it into your microphone.",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#27273d",
+ "theme_color": "#27273d",
+ "orientation": "portrait-primary",
+ "icons": [
+ {
+ "src": "https://i.ibb.co/Kb6SkTm/8399350-mic-microphone-audio-icon.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "https://i.ibb.co/Kb6SkTm/8399350-mic-microphone-audio-icon.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ],
+ "permissions": [
+ "microphone"
+ ]
+ }
+
\ No newline at end of file
diff --git a/Games/Speaking Number Guessings/script.js b/Games/Speaking Number Guessings/script.js
new file mode 100644
index 0000000000..f80a749a91
--- /dev/null
+++ b/Games/Speaking Number Guessings/script.js
@@ -0,0 +1,56 @@
+const messageElement = document.getElementById("msg");
+
+const randomNumber = getRandomNumber();
+
+window.SpeechRecognition =
+ window.SpeechRecognition || window.webkitSpeechRecognition;
+let recognition = new window.SpeechRecognition();
+recognition.start();
+
+function getRandomNumber() {
+ return Math.floor(Math.random() * 100) + 1;
+}
+
+function onSpeak(event) {
+ const message = event.results[0][0].transcript;
+ writeMessage(message);
+ checkNumber(message);
+}
+
+function writeMessage(message) {
+ messageElement.innerHTML = `
+