diff --git a/Crack code/your files/index.html b/Crack code/your files/index.html new file mode 100644 index 00000000..ce88a6d9 --- /dev/null +++ b/Crack code/your files/index.html @@ -0,0 +1,83 @@ + + + + + + + + + + + Code Cracker + + + + + + + +
+

Code Cracker

+

+ Created By Avdhesh Varshney +

+ +
+ +
+ +
+ +
+

+ +

+

Keep guessing

+
+ +
+ +
+ +
+ Rules : + +
+
+ + + + + + \ No newline at end of file diff --git a/Crack code/your files/manifest.json b/Crack code/your files/manifest.json new file mode 100644 index 00000000..381c88ee --- /dev/null +++ b/Crack code/your files/manifest.json @@ -0,0 +1,15 @@ +{ + "manifest_version": 3, + "name": "Crack Code", + "description": "Crack the code with the hints given to you and according to the rules and enjoy the game", + "browser_action":{ + "default_popup":"index.html" + }, + "background": { + "service_worker": "script.js", + "styles" : "style.css" + }, + "permissions":["activeTab"] + +} + \ No newline at end of file diff --git a/Crack code/your files/script.js b/Crack code/your files/script.js new file mode 100644 index 00000000..d74a7f45 --- /dev/null +++ b/Crack code/your files/script.js @@ -0,0 +1,115 @@ +var secret_code = generateCode(); +var step_counter = 0; +var show = document.getElementById('show'); +var ans = document.getElementById('code'); + +document.getElementById("submit").addEventListener("click", getInput); + +document.addEventListener('keypress', (e) => { + if (e.key === 'Enter') { + getInput(); + } +}); + +function getInput() { + var x = document.getElementById('i_p').value; + var o_p = document.getElementById("o_p"); + o_p.innerHTML = x; + processInput(x); +} + +function processInput(input) { + var n = input.length; + if (document.getElementById("submit").innerHTML === "Reset") { + cleanAll(); + } + else if (n > 4) { + o_p.innerHTML = "Input exceeds 4 character!"; + } + else if (n < 4) { + o_p.innerHTML = "Input is less than 4 character!"; + } + else if (step_counter === 10) { + document.getElementById("is_game").innerHTML = "Fool, You Loose! Eat some Horlics!"; + + show.style.display = ''; + show.addEventListener('click', () => { + ans.style.display = ''; + show.style.display = 'none'; + }); + resetGame(); + } + else { + step_counter++; + checkSubmission(input); + } + + return; +} + +function generateCode() { + var code = ""; + for (var i = 0; i < 4; i++) { + var n = getRandomIntInclusive(0, 9); + code += n.toString(); + } + document.getElementById("code").innerHTML = code; + return code; +} + +function getRandomIntInclusive(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +function checkSubmission(usr_input) { + if (usr_input === secret_code) { + document.getElementById("is_game").innerHTML = "Good guess! You win!!"; + resetGame(); + } + var result = ""; + + for (var i = 0; i < 4; i++) { + var found = false; + if (usr_input[i] === secret_code[i]) { + result += "Y "; + found = true; + continue; + } + for (var j = 0; j < 4; j++) { + if (usr_input[i] === secret_code[j]) { + result += "E "; + found = true; + break; + } + } + if (!found) { + result += "X "; + } + } + document.getElementById("check").innerHTML = result; + showSubmission(result, usr_input); + return; +} +function showSubmission(result, usr_input) { + var ul = document.getElementById("step"); + var li = document.createElement("li"); + li.appendChild(document.createTextNode(usr_input + " >>> " + result)); + ul.appendChild(li); +} + +function resetGame() { + document.getElementById("submit").innerHTML = "Reset"; +} + +function cleanAll() { + secret_code = generateCode(); + step_counter = 0; + document.getElementById("step").innerHTML = "
  • Guess   Result
  • " + document.getElementById("submit").innerHTML = "Submit"; + show.style.display = 'none'; + ans.style.display = 'none'; + document.getElementById('is_game').innerHTML = ''; + return; +} diff --git a/Crack code/your files/style.css b/Crack code/your files/style.css new file mode 100644 index 00000000..de9eb150 --- /dev/null +++ b/Crack code/your files/style.css @@ -0,0 +1,118 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + text-decoration: none; + user-select: none; +} + +body { + background-color: aquamarine; +} + +#step { + list-style: none; +} + +.game { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: rgba(red, green, blue, 0.3); + box-shadow: 0 0 100px 0 black; + border-radius: 1rem; + width: 90vh; + height: 90vh; + padding: 1rem; + text-align: center; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + transition: all 0.4s; +} + +h1 { + font-size: 2.5rem; + margin-bottom: 5px; + font-weight: 500; + font-family: cursive; + color: chocolate; +} + +.input-section, +.output-section, +.result-section, +#rules { + margin: 5px 0; +} + +.input-section input { + padding: 5px; + outline: none; + border: none; + text-align: center; + border-radius: 10px; + font-size: 1.2rem; +} + +.input-section input:hover { + box-shadow: 0 2px 50px 0 lightseagreen; +} + +.input-section button { + padding: 10px; + font-size: 1rem; + border-radius: 10px; + outline: none; + border: none; + text-transform: uppercase; + background-color: aqua; + box-shadow: 0 2px 10px black; + transition: all 0.2s; +} + +.input-section button:hover { + box-shadow: 0 0 25px 0 black; + background-color: black; + color: white; +} + +.output-section p { + font-size: 1.2rem; + margin: 2px 0; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 2px; +} + +.output-section #code { + color: lightcoral; +} + +.result-section { + margin: 5px 0; + letter-spacing: 2px; + list-style: none; +} + +#rules ul { + list-style: none; + letter-spacing: 1px; +} + +.developer { + font-size: 1.2rem; + color: #313136; + margin-bottom: 10px; +} + +.developer a { + text-decoration: none; + color: #313136; +} + +.developer a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/Name Fate/index.html b/Name Fate/index.html new file mode 100644 index 00000000..8c7e819f --- /dev/null +++ b/Name Fate/index.html @@ -0,0 +1,21 @@ + + + + + + Name Fate + + + +
    +

    FLAMES Game

    +
    + + +
    + +
    +
    + + + diff --git a/Name Fate/manifest.json b/Name Fate/manifest.json new file mode 100644 index 00000000..e035ba67 --- /dev/null +++ b/Name Fate/manifest.json @@ -0,0 +1,23 @@ +{ + "manifest_version": 3, + "name": "Name Fate", + "version": "1.0", + "description": "NameFate is an intriguing game that explores the mystical connections between names and destinies. ", + "permissions": [ + "storage" + ], + "optional-permissions" : ["tabs"], + "action": { + "default_popup": "index.html" + }, + "web_accessible_resources": [ + { + "resources": [ + "index.html" + ], + "matches": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Name Fate/script.js b/Name Fate/script.js new file mode 100644 index 00000000..e122f2a1 --- /dev/null +++ b/Name Fate/script.js @@ -0,0 +1,29 @@ +function calculateFlames() { + const name1 = document.getElementById('name1').value.toLowerCase().replace(/\s+/g, ''); + const name2 = document.getElementById('name2').value.toLowerCase().replace(/\s+/g, ''); + + if (!name1 || !name2) { + alert('Please enter both names'); + return; + } + + let combinedName = name1 + name2; + + // Count occurrences of each character + const charCount = {}; + for (let char of combinedName) { + charCount[char] = (charCount[char] || 0) + 1; + } + + // Calculate the flames number + let flamesCount = 0; + for (let char in charCount) { + flamesCount += charCount[char] % 2; + } + + const flames = ['Friends', 'Lovers', 'Affectionate', 'Marriage', 'Enemies', 'Siblings']; + + let resultIndex = (flamesCount - 1) % flames.length; + + document.getElementById('result').textContent = flames[resultIndex]; +} diff --git a/Name Fate/styles.css b/Name Fate/styles.css new file mode 100644 index 00000000..f7208fa3 --- /dev/null +++ b/Name Fate/styles.css @@ -0,0 +1,55 @@ +body { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f0f0f0; + margin: 0; + font-family: Arial, sans-serif; + background-image: linear-gradient(315deg, #90d5ec 0%, #fc575e 74%); + height: 100vh; + overflow: hidden; +} + +.container { + text-align: center; + background-color: #ffffff; + padding: 20px; + border-radius: 10px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +.input-group { + margin-bottom: 20px; +} + +input { + width: 200px; + padding: 10px; + margin: 5px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + padding: 10px 20px; + background-color: #007BFF; + color: #fff; + border: none; + border-radius: 5px; + cursor: pointer; +} + +button:hover { + background-color: #0056b3; +} + +#result { + margin-top: 20px; + font-size: 20px; + font-weight: bold; +} + + + +