Skip to content

Commit d950c47

Browse files
committed
added name fate
1 parent ff94a89 commit d950c47

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

Name Fate/index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!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>Name Fate</title>
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>FLAMES Game</h1>
12+
<div class="input-group">
13+
<input type="text" id="name1" placeholder="Enter first name">
14+
<input type="text" id="name2" placeholder="Enter second name">
15+
</div>
16+
<button onclick="calculateFlames()">Calculate</button>
17+
<div id="result"></div>
18+
</div>
19+
<script src="script.js"></script>
20+
</body>
21+
</html>

Name Fate/manifest.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "Name Fate",
4+
"version": "1.0",
5+
"description": "NameFate is an intriguing game that explores the mystical connections between names and destinies. ",
6+
"permissions": [
7+
"storage"
8+
],
9+
"optional-permissions" : ["tabs"],
10+
"action": {
11+
"default_popup": "index.html"
12+
},
13+
"web_accessible_resources": [
14+
{
15+
"resources": [
16+
"index.html"
17+
],
18+
"matches": [
19+
"<all_urls>"
20+
]
21+
}
22+
]
23+
}

Name Fate/script.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function calculateFlames() {
2+
const name1 = document.getElementById('name1').value.toLowerCase().replace(/\s+/g, '');
3+
const name2 = document.getElementById('name2').value.toLowerCase().replace(/\s+/g, '');
4+
5+
if (!name1 || !name2) {
6+
alert('Please enter both names');
7+
return;
8+
}
9+
10+
let combinedName = name1 + name2;
11+
12+
// Count occurrences of each character
13+
const charCount = {};
14+
for (let char of combinedName) {
15+
charCount[char] = (charCount[char] || 0) + 1;
16+
}
17+
18+
// Calculate the flames number
19+
let flamesCount = 0;
20+
for (let char in charCount) {
21+
flamesCount += charCount[char] % 2;
22+
}
23+
24+
const flames = ['Friends', 'Lovers', 'Affectionate', 'Marriage', 'Enemies', 'Siblings'];
25+
26+
let resultIndex = (flamesCount - 1) % flames.length;
27+
28+
document.getElementById('result').textContent = flames[resultIndex];
29+
}

Name Fate/styles.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
body {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
height: 100vh;
6+
background-color: #f0f0f0;
7+
margin: 0;
8+
font-family: Arial, sans-serif;
9+
background-image: linear-gradient(315deg, #90d5ec 0%, #fc575e 74%);
10+
height: 100vh;
11+
overflow: hidden;
12+
}
13+
14+
.container {
15+
text-align: center;
16+
background-color: #ffffff;
17+
padding: 20px;
18+
border-radius: 10px;
19+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
20+
}
21+
22+
.input-group {
23+
margin-bottom: 20px;
24+
}
25+
26+
input {
27+
width: 200px;
28+
padding: 10px;
29+
margin: 5px;
30+
border: 1px solid #ccc;
31+
border-radius: 5px;
32+
}
33+
34+
button {
35+
padding: 10px 20px;
36+
background-color: #007BFF;
37+
color: #fff;
38+
border: none;
39+
border-radius: 5px;
40+
cursor: pointer;
41+
}
42+
43+
button:hover {
44+
background-color: #0056b3;
45+
}
46+
47+
#result {
48+
margin-top: 20px;
49+
font-size: 20px;
50+
font-weight: bold;
51+
}
52+
53+
54+
55+

0 commit comments

Comments
 (0)