-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscenario.html
More file actions
316 lines (302 loc) · 11.7 KB
/
scenario.html
File metadata and controls
316 lines (302 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nagrik Aur Samvidhan: Constitutional Adventure</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #FF9933, #FFFFFF, #138808);
background-size: 600% 600%;
animation: gradientBG 15s ease infinite;
}
@keyframes gradientBG {
0% {background-position: 0% 50%;}
50% {background-position: 100% 50%;}
100% {background-position: 0% 50%;}
}
.game-container {
background-color: rgba(255, 255, 255, 0.9);
border-radius: 15px;
padding: 30px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
max-width: 800px;
width: 90%;
backdrop-filter: blur(10px);
}
h1 {
color: #1a237e;
text-align: center;
margin-bottom: 20px;
font-size: 2.5em;
text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}
.scenario {
background-color: #e8eaf6;
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
font-size: 18px;
line-height: 1.6;
box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}
.question {
font-weight: 600;
margin-bottom: 15px;
color: #303f9f;
font-size: 1.2em;
}
.options {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
}
.option {
background-color: #c5cae9;
border: none;
border-radius: 8px;
padding: 15px;
font-size: 16px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.option:hover {
background-color: #9fa8da;
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.option.selected {
background-color: #3f51b5;
color: white;
}
.feedback {
margin-top: 20px;
font-weight: 600;
text-align: center;
color: #4caf50;
}
.button-container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.btn, .back-btn {
border: none;
border-radius: 8px;
padding: 12px 24px;
font-size: 18px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
text-decoration: none;
display: inline-block;
text-align: center;
}
.btn:hover, .back-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}
.back-btn {
background-color: #f44336;
color: white;
}
.back-btn:hover {
background-color: #d32f2f;
}
.btn {
background-color: #4caf50;
color: white;
}
.btn:hover {
background-color: #45a049;
}
.progress-bar {
height: 10px;
background-color: #e0e0e0;
border-radius: 5px;
margin-top: 20px;
overflow: hidden;
box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}
.progress {
height: 100%;
background: linear-gradient(90deg, #4caf50, #8bc34a);
width: 0%;
transition: width 0.5s ease-in-out;
}
</style>
</head>
<body>
<div class="game-container">
<h1>Nagrik Aur Samvidhan: Constitutional Adventure</h1>
<div class="scenario" id="scenario"></div>
<div class="question" id="question"></div>
<div class="options" id="options"></div>
<div class="feedback" id="feedback"></div>
<div class="button-container">
<a href="index.html" class="back-btn">Back to Home</a>
<button class="btn" id="nextBtn" style="display: none;">Next Question</button>
</div>
<div class="progress-bar">
<div class="progress" id="progress"></div>
</div>
</div>
<script>
const scenarios = [
{
scenario: "Ravi, a college student, wants to organize a peaceful protest against a new government policy. He's unsure about his rights.",
question: "Which fundamental right is most relevant to Ravi's situation?",
options: [
"Right to Freedom of Speech and Expression",
"Right to Education",
"Right to Property",
"Right to Constitutional Remedies"
],
correct: 0
},
{
scenario: "Meera, a factory worker, discovers that she's being paid less than her male colleagues for the same work.",
question: "Which constitutional provision addresses Meera's situation?",
options: [
"Right to Equality",
"Right to Freedom of Religion",
"Right against Exploitation",
"Right to Privacy"
],
correct: 0
},
{
scenario: "The local government plans to acquire farmland for a development project. The farmers are worried about fair compensation.",
question: "Which article of the Constitution deals with the right to property and fair compensation?",
options: [
"Article 14",
"Article 21",
"Article 300A",
"Article 32"
],
correct: 2
},
{
scenario: "A new law is passed that seems to violate fundamental rights. Citizens want to challenge it in court.",
question: "Which remedy can citizens use to directly approach the Supreme Court for enforcement of fundamental rights?",
options: [
"Habeas Corpus",
"Mandamus",
"Quo Warranto",
"Writ Petition under Article 32"
],
correct: 3
},
{
scenario: "A minority community wants to establish an educational institution to preserve their language and culture.",
question: "Which article of the Constitution protects the rights of minorities to establish and administer educational institutions?",
options: [
"Article 29",
"Article 30",
"Article 31",
"Article 32"
],
correct: 1
}
];
let currentQuestion = 0;
let score = 0;
document.getElementById('nextBtn').onclick = function() {
currentQuestion++;
if (currentQuestion < scenarios.length) {
loadQuestion();
updateProgress();
} else {
showFinalScore();
}
};
function loadQuestion() {
const current = scenarios[currentQuestion];
document.getElementById('scenario').textContent = current.scenario;
document.getElementById('question').textContent = current.question;
const optionsContainer = document.getElementById('options');
optionsContainer.innerHTML = '';
current.options.forEach((option, index) => {
const button = document.createElement('button');
button.className = 'option';
button.textContent = option;
button.onclick = () => selectOption(index);
optionsContainer.appendChild(button);
});
document.getElementById('feedback').textContent = '';
document.getElementById('nextBtn').style.display = 'none';
}
function selectOption(index) {
const options = document.querySelectorAll('.option');
options.forEach(option => option.classList.remove('selected'));
options[index].classList.add('selected');
const current = scenarios[currentQuestion];
if (index === current.correct) {
document.getElementById('feedback').textContent = 'Correct! Well done!';
score++;
} else {
document.getElementById('feedback').textContent = 'Incorrect. The correct answer is: ' + current.options[current.correct];
}
document.getElementById('nextBtn').style.display = 'inline-block';
}
function updateProgress() {
const progressBar = document.getElementById('progress');
const progress = ((currentQuestion + 1) / scenarios.length) * 100;
progressBar.style.width = `${progress}%`;
}
function showFinalScore() {
const container = document.querySelector('.game-container');
container.innerHTML = `
<h1>Game Completed!</h1>
<p>Your final score: ${score} out of ${scenarios.length}</p>
<p>Thank you for playing Nagrik Aur Samvidhan: Constitutional Adventure!</p>
<div class="button-container">
<a href="index.html" class="back-btn">Back to Home</a>
<button class="btn" onclick="restartGame()">Play Again</button>
</div>
`;
}
function restartGame() {
currentQuestion = 0;
score = 0;
const container = document.querySelector('.game-container');
container.innerHTML = `
<h1>Nagrik Aur Samvidhan: Constitutional Adventure</h1>
<div class="scenario" id="scenario"></div>
<div class="question" id="question"></div>
<div class="options" id="options"></div>
<div class="feedback" id="feedback"></div>
<div class="button-container">
<a href="index.html" class="back-btn">Back to Home</a>
<button class="btn" id="nextBtn" style="display: none;">Next Question</button>
</div>
<div class="progress-bar">
<div class="progress" id="progress"></div>
</div>
`;
document.getElementById('nextBtn').onclick = function() {
currentQuestion++;
if (currentQuestion < scenarios.length) {
loadQuestion();
updateProgress();
} else {
showFinalScore();
}
};
loadQuestion();
updateProgress();
}
loadQuestion();
updateProgress();
</script>
</body>
</html>