@arcade-v/arcade_v 0.1.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,494 @@
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" />
6
+ <title>Fractions — A Friendly Guide</title>
7
+ <style>
8
+ :root{
9
+ --bg:#0f1724; --card:#0b1220; --muted:#9aa7b9; --accent:#6ee7b7; --accent2:#7dd3fc;
10
+ --glass: rgba(255,255,255,0.03);
11
+ --radius:14px;
12
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
13
+ }
14
+ *{box-sizing:border-box}
15
+ body{
16
+ margin:0;
17
+ background:linear-gradient(180deg,#041022 0%, #071028 60%);
18
+ color:#e6eef6;
19
+ padding:28px;
20
+ line-height:1.5;
21
+ }
22
+ .wrap{
23
+ max-width:980px;
24
+ margin:0 auto;
25
+ display:grid;
26
+ gap:18px;
27
+ }
28
+ header{
29
+ display:flex;
30
+ align-items:center;
31
+ gap:16px;
32
+ }
33
+ .logo{
34
+ width:64px;
35
+ height:64px;
36
+ background:linear-gradient(135deg,var(--accent),var(--accent2));
37
+ border-radius:12px;
38
+ display:flex;
39
+ align-items:center;
40
+ justify-content:center;
41
+ color:#032229;
42
+ font-weight:700;
43
+ font-size:20px;
44
+ box-shadow:0 6px 18px rgba(0,0,0,0.5);
45
+ }
46
+ h1{font-size:28px;margin:0}
47
+ .subtitle{color:var(--muted);font-size:14px}
48
+ main{
49
+ display:grid;
50
+ grid-template-columns: 1fr 360px;
51
+ gap:18px;
52
+ align-items:start;
53
+ }
54
+ article{
55
+ background:var(--card);
56
+ padding:18px;
57
+ border-radius:var(--radius);
58
+ box-shadow:0 6px 30px rgba(3,8,18,0.6);
59
+ }
60
+ aside{
61
+ background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
62
+ padding:18px;
63
+ border-radius:12px;
64
+ min-width:220px;
65
+ color:var(--muted);
66
+ }
67
+ h2{margin:8px 0 12px 0;font-size:20px}
68
+ p{margin:0 0 12px 0}
69
+ .example{
70
+ background:var(--glass);
71
+ padding:10px;
72
+ border-radius:10px;
73
+ color:var(--accent2);
74
+ font-weight:600;
75
+ display:inline-block;
76
+ }
77
+ .fraction-visual{
78
+ margin:12px 0;
79
+ }
80
+ .controls{
81
+ display:flex;
82
+ gap:8px;
83
+ flex-wrap:wrap;
84
+ }
85
+ input[type="number"], select, input[type="text"]{
86
+ padding:8px 10px;
87
+ border-radius:8px;
88
+ border:1px solid rgba(255,255,255,0.06);
89
+ background:transparent;
90
+ color:inherit;
91
+ min-width:90px;
92
+ }
93
+ button{
94
+ background:linear-gradient(180deg,var(--accent),var(--accent2));
95
+ border:none;
96
+ color:#032229;
97
+ padding:8px 12px;
98
+ border-radius:8px;
99
+ cursor:pointer;
100
+ font-weight:700;
101
+ }
102
+ pre{
103
+ background:#041423;
104
+ padding:10px;border-radius:8px;overflow:auto;color:var(--muted)
105
+ }
106
+ .result{
107
+ margin-top:12px;
108
+ padding:10px;border-radius:8px;
109
+ background:linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
110
+ border:1px dashed rgba(255,255,255,0.03);
111
+ color:var(--accent);
112
+ font-weight:700;
113
+ }
114
+ .small{font-size:13px;color:var(--muted)}
115
+ footer{color:var(--muted);font-size:13px;text-align:center;padding:8px 0}
116
+ /* fraction boxes */
117
+ .bar{
118
+ display:flex;
119
+ gap:4px;
120
+ margin-top:8px;
121
+ align-items:center;
122
+ }
123
+ .box{
124
+ flex:1 1 0;
125
+ height:36px;
126
+ background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.05));
127
+ border-radius:6px;
128
+ display:flex;
129
+ align-items:center;
130
+ justify-content:center;
131
+ color:var(--muted);
132
+ font-weight:700;
133
+ position:relative;
134
+ border:1px solid rgba(255,255,255,0.02);
135
+ overflow:hidden;
136
+ }
137
+ .box.filled{
138
+ background:linear-gradient(90deg, rgba(110,231,183,0.12), rgba(125,211,252,0.06));
139
+ color:#032229;
140
+ }
141
+ .fraction-inline{
142
+ font-weight:800;
143
+ background:linear-gradient(90deg, rgba(255,255,255,0.03), rgba(0,0,0,0.04));
144
+ padding:6px 10px;border-radius:8px;margin-left:8px;color:var(--accent2)
145
+ }
146
+ .math-row{display:flex;gap:8px;align-items:center;margin-top:6px;flex-wrap:wrap}
147
+ .hint{font-size:13px;color:var(--muted)}
148
+ @media (max-width:900px){
149
+ main{grid-template-columns:1fr; }
150
+ aside{order:2}
151
+ }
152
+ </style>
153
+ </head>
154
+ <body>
155
+ <div class="wrap">
156
+ <header>
157
+ <div class="logo">F⁄</div>
158
+ <div>
159
+ <h1>Fractions — a friendly guide</h1>
160
+ <div class="subtitle">Understand parts of a whole, equivalent fractions, simplifying, and quick tools</div>
161
+ </div>
162
+ </header>
163
+
164
+ <main>
165
+ <article>
166
+ <h2>What is a fraction?</h2>
167
+ <p>A <strong>fraction</strong> represents a part of a whole and has two parts: the <em>numerator</em> (top) and the <em>denominator</em> (bottom). Example: <span class="example">3/4</span> means three out of four equal parts.</p>
168
+
169
+ <h2>Types of fractions</h2>
170
+ <p><strong>Proper</strong>: numerator &lt; denominator (e.g., 2/3).<br>
171
+ <strong>Improper</strong>: numerator ≥ denominator (e.g., 7/4).<br>
172
+ <strong>Mixed number</strong>: whole number + proper fraction (e.g., 1 3/4).</p>
173
+
174
+ <h2>Visualize fractions</h2>
175
+ <p class="small">Adjust denominator (boxes) and numerator (filled boxes) to see the fraction visually.</p>
176
+
177
+ <div class="fraction-visual" aria-hidden="true">
178
+ <label class="small">Numerator:
179
+ <input id="vizNum" type="number" value="3" min="0" style="width:72px">
180
+ </label>
181
+ <label class="small" style="margin-left:8px">Denominator:
182
+ <input id="vizDen" type="number" value="5" min="1" style="width:72px">
183
+ </label>
184
+ <button id="renderBtn">Render</button>
185
+
186
+ <div id="barContainer" class="bar" role="img" aria-label="Fraction visualization"></div>
187
+ <div style="margin-top:8px">
188
+ <span class="hint">Fraction: </span><span id="vizText" class="fraction-inline">3 / 5</span>
189
+ <span class="hint" style="margin-left:12px">Decimal: <span id="vizDecimal" class="fraction-inline">0.6</span></span>
190
+ </div>
191
+ </div>
192
+
193
+ <hr style="margin:18px 0;border:none;border-top:1px solid rgba(255,255,255,0.03)">
194
+
195
+ <h2>Quick tools</h2>
196
+ <div class="math-row">
197
+ <div>
198
+ <div class="small">Simplify a fraction</div>
199
+ <div class="controls">
200
+ <input id="simpNum" type="number" placeholder="numerator" value="8" min="0">
201
+ <input id="simpDen" type="number" placeholder="denominator" value="12" min="1">
202
+ <button id="simpBtn">Simplify</button>
203
+ </div>
204
+ <div id="simpResult" class="result" aria-live="polite" style="display:none"></div>
205
+ </div>
206
+
207
+ <div style="min-width:14px"></div>
208
+
209
+ <div>
210
+ <div class="small">Convert improper ↔ mixed</div>
211
+ <div class="controls">
212
+ <input id="impNum" type="number" placeholder="numerator" value="11" min="0">
213
+ <input id="impDen" type="number" placeholder="denominator" value="4" min="1">
214
+ <button id="convBtn">Convert</button>
215
+ </div>
216
+ <div id="convResult" class="result" aria-live="polite" style="display:none"></div>
217
+ </div>
218
+ </div>
219
+
220
+ <hr style="margin:18px 0;border:none;border-top:1px solid rgba(255,255,255,0.03)">
221
+
222
+ <h2>Fraction calculator</h2>
223
+ <p class="small">Enter two fractions and choose an operation.</p>
224
+ <div style="display:grid;gap:8px">
225
+ <div style="display:flex;gap:8px;flex-wrap:wrap">
226
+ <label class="small">A:
227
+ <input id="aNum" type="number" value="1" min="0" style="width:80px"> /
228
+ <input id="aDen" type="number" value="2" min="1" style="width:80px">
229
+ </label>
230
+
231
+ <label class="small">B:
232
+ <input id="bNum" type="number" value="2" min="0" style="width:80px"> /
233
+ <input id="bDen" type="number" value="3" min="1" style="width:80px">
234
+ </label>
235
+
236
+ <select id="op" aria-label="operation">
237
+ <option value="add">+</option>
238
+ <option value="sub">−</option>
239
+ <option value="mul">×</option>
240
+ <option value="div">÷</option>
241
+ </select>
242
+
243
+ <button id="calcBtn">Calculate</button>
244
+ <button id="clearBtn" style="background:transparent;color:var(--muted);border:1px solid rgba(255,255,255,0.04)">Clear</button>
245
+ </div>
246
+
247
+ <div id="calcResult" class="result" aria-live="polite" style="display:none"></div>
248
+ </div>
249
+
250
+ <hr style="margin:18px 0;border:none;border-top:1px solid rgba(255,255,255,0.03)">
251
+
252
+ <h2>How to simplify (short)</h2>
253
+ <p>Find the greatest common divisor (GCD) of numerator and denominator, then divide both by it. Example: 8/12 → GCD=4 → 2/3.</p>
254
+
255
+ <h2>Tips</h2>
256
+ <ul class="small" style="color:var(--muted)">
257
+ <li>To add/subtract, get a common denominator.</li>
258
+ <li>To multiply, multiply numerators and denominators directly.</li>
259
+ <li>To divide by a fraction, multiply by its reciprocal (swap numerator/denominator).</li>
260
+ </ul>
261
+ </article>
262
+
263
+ <aside>
264
+ <h3 style="margin-top:0">Reference</h3>
265
+ <p class="small">Useful representations:</p>
266
+ <pre>Fraction: a / b
267
+ Mixed: w a / b (meaning w + a/b)
268
+ Decimal: a ÷ b</pre>
269
+
270
+ <h3 style="margin-top:8px">Examples</h3>
271
+ <p class="small">Two-thirds: <span class="example">2/3</span></p>
272
+ <p class="small">One and a half: <span class="example">1 1/2</span></p>
273
+
274
+ <h3 style="margin-top:8px">Keyboard tips</h3>
275
+ <p class="small">Use arrow keys to change number inputs quickly, or type values directly.</p>
276
+ </aside>
277
+ </main>
278
+
279
+ <footer>Built for learning — interactive and accessible.</footer>
280
+ </div>
281
+
282
+ <script>
283
+
284
+ // Utility functions
285
+ function gcd(a, b) {
286
+ a = Math.abs(Math.trunc(a));
287
+ b = Math.abs(Math.trunc(b));
288
+ if (a === 0) return b;
289
+ if (b === 0) return a;
290
+ while (b) {
291
+ let t = a % b;
292
+ a = b;
293
+ b = t;
294
+ }
295
+ return Math.abs(a);
296
+ }
297
+
298
+ function simplify(n, d) {
299
+ n = Math.trunc(n); d = Math.trunc(d);
300
+ if (d === 0) return null;
301
+ const g = gcd(n, d);
302
+ n = n / g; d = d / g;
303
+ // keep sign only in numerator
304
+ if (d < 0) { n = -n; d = -d; }
305
+ return {n, d};
306
+ }
307
+
308
+ function toDecimal(n, d) {
309
+ if (d === 0) return NaN;
310
+ return Number(n) / Number(d);
311
+ }
312
+
313
+ function improperToMixed(n, d) {
314
+ n = Math.trunc(n); d = Math.trunc(d);
315
+ if (d === 0) return null;
316
+ const whole = Math.trunc(n / d);
317
+ const rem = Math.abs(n % d);
318
+ return {whole, num: rem, den: Math.abs(d)};
319
+ }
320
+
321
+ function mixedToImproper(w, n, d) {
322
+ w = Math.trunc(w); n = Math.trunc(n); d = Math.trunc(d);
323
+ if (d === 0) return null;
324
+ const sign = (w < 0) ? -1 : 1;
325
+ const totalNum = Math.abs(w) * d + Math.abs(n);
326
+ return {n: sign * totalNum, d: d};
327
+ }
328
+
329
+ function renderBar(n, d, containerEl) {
330
+ containerEl.innerHTML = '';
331
+ d = Math.max(1, Math.trunc(d));
332
+ n = Math.max(0, Math.trunc(n));
333
+ const maxBoxes = Math.min(20, d); // avoid crazy widths
334
+ const boxCount = d > 20 ? 20 : d;
335
+ // If denominator > 20, we instead show a compact text + small mini-bars
336
+ if (d > 20) {
337
+ const p = document.createElement('div');
338
+ p.className = 'small';
339
+ p.textContent = `${n} / ${d} — visual shows first 20 parts`;
340
+ containerEl.appendChild(p);
341
+ }
342
+ for (let i = 0; i < boxCount; i++) {
343
+ const box = document.createElement('div');
344
+ box.className = 'box';
345
+ // Determine fill based on proportion when d > 20
346
+ const fillIndex = Math.round((n / d) * boxCount);
347
+ if (i < fillIndex) box.classList.add('filled');
348
+ box.textContent = i + 1;
349
+ containerEl.appendChild(box);
350
+ }
351
+ }
352
+
353
+ // Visualization handlers
354
+ const vizNum = document.getElementById('vizNum');
355
+ const vizDen = document.getElementById('vizDen');
356
+ const renderBtn = document.getElementById('renderBtn');
357
+ const barContainer = document.getElementById('barContainer');
358
+ const vizText = document.getElementById('vizText');
359
+ const vizDecimal = document.getElementById('vizDecimal');
360
+
361
+ function updateViz() {
362
+ const n = Number(vizNum.value) || 0;
363
+ const d = Number(vizDen.value) || 1;
364
+ renderBar(n, d, barContainer);
365
+ vizText.textContent = `${n} / ${d}`;
366
+ const dec = toDecimal(n, d);
367
+ vizDecimal.textContent = isFinite(dec) ? (Math.round(dec*10000)/10000) : 'NaN';
368
+ }
369
+ renderBtn.addEventListener('click', updateViz);
370
+ // initial
371
+ updateViz();
372
+
373
+ // Simplify
374
+ const simpBtn = document.getElementById('simpBtn');
375
+ const simpNum = document.getElementById('simpNum');
376
+ const simpDen = document.getElementById('simpDen');
377
+ const simpResult = document.getElementById('simpResult');
378
+
379
+ simpBtn.addEventListener('click', () => {
380
+ const n = Number(simpNum.value);
381
+ const d = Number(simpDen.value);
382
+ if (!Number.isFinite(n) || !Number.isFinite(d) || d === 0) {
383
+ simpResult.style.display = 'block';
384
+ simpResult.textContent = 'Invalid input. Denominator cannot be 0.';
385
+ return;
386
+ }
387
+ const s = simplify(n,d);
388
+ simpResult.style.display = 'block';
389
+ if (!s) { simpResult.textContent = 'Error'; return; }
390
+ // show simplified and mixed if improper
391
+ const improper = s.n >= s.d || s.n <= -s.d;
392
+ const mixed = improper ? improperToMixed(s.n, s.d) : null;
393
+ let txt = `${s.n} / ${s.d}`;
394
+ if (mixed && mixed.whole !== 0) {
395
+ txt += ` → mixed: ${mixed.whole} ${mixed.num}/${mixed.den}`;
396
+ }
397
+ txt += ` (decimal ${isFinite(toDecimal(s.n,s.d)) ? Math.round(toDecimal(s.n,s.d)*10000)/10000 : 'NaN'})`;
398
+ simpResult.textContent = txt;
399
+ });
400
+
401
+ // Convert improper <-> mixed
402
+ const convBtn = document.getElementById('convBtn');
403
+ const impNum = document.getElementById('impNum');
404
+ const impDen = document.getElementById('impDen');
405
+ const convResult = document.getElementById('convResult');
406
+
407
+ convBtn.addEventListener('click', () => {
408
+ const n = Number(impNum.value);
409
+ const d = Number(impDen.value);
410
+ if (!Number.isFinite(n) || !Number.isFinite(d) || d === 0) {
411
+ convResult.style.display = 'block';
412
+ convResult.textContent = 'Invalid input.';
413
+ return;
414
+ }
415
+ const mixed = improperToMixed(n,d);
416
+ convResult.style.display = 'block';
417
+ convResult.textContent = `${n}/${d} = ${mixed.whole} ${mixed.num}/${mixed.den} (mixed)`;
418
+ });
419
+
420
+ // Calculator
421
+ const calcBtn = document.getElementById('calcBtn');
422
+ const clearBtn = document.getElementById('clearBtn');
423
+ const calcResult = document.getElementById('calcResult');
424
+
425
+ function computeFraction(op, aN,aD,bN,bD) {
426
+ aN = Math.trunc(aN); aD = Math.trunc(aD); bN = Math.trunc(bN); bD = Math.trunc(bD);
427
+ if (aD === 0 || bD === 0) return null;
428
+ let rN, rD;
429
+ switch(op) {
430
+ case 'add':
431
+ rN = aN * bD + bN * aD;
432
+ rD = aD * bD;
433
+ break;
434
+ case 'sub':
435
+ rN = aN * bD - bN * aD;
436
+ rD = aD * bD;
437
+ break;
438
+ case 'mul':
439
+ rN = aN * bN;
440
+ rD = aD * bD;
441
+ break;
442
+ case 'div':
443
+ if (bN === 0) return null;
444
+ rN = aN * bD;
445
+ rD = aD * bN;
446
+ break;
447
+ default:
448
+ return null;
449
+ }
450
+ const s = simplify(rN, rD);
451
+ return s ? {n:s.n, d:s.d, decimal: toDecimal(s.n, s.d)} : null;
452
+ }
453
+
454
+ calcBtn.addEventListener('click', () => {
455
+ const aN = Number(document.getElementById('aNum').value);
456
+ const aD = Number(document.getElementById('aDen').value);
457
+ const bN = Number(document.getElementById('bNum').value);
458
+ const bD = Number(document.getElementById('bDen').value);
459
+ const op = document.getElementById('op').value;
460
+ const res = computeFraction(op, aN,aD,bN,bD);
461
+ calcResult.style.display = 'block';
462
+ if (!res) {
463
+ calcResult.textContent = 'Invalid operation or input (check denominators and division by zero).';
464
+ } else {
465
+ // show improper and mixed if applicable
466
+ const mixed = improperToMixed(res.n, res.d);
467
+ let txt = `${res.n} / ${res.d}`;
468
+ if (mixed.whole !== 0) txt += ` → mixed: ${mixed.whole} ${mixed.num}/${mixed.den}`;
469
+ txt += ` (decimal ${Math.round(res.decimal*10000)/10000})`;
470
+ calcResult.textContent = txt;
471
+ }
472
+ });
473
+
474
+ clearBtn.addEventListener('click', () => {
475
+ document.getElementById('aNum').value = 1;
476
+ document.getElementById('aDen').value = 2;
477
+ document.getElementById('bNum').value = 2;
478
+ document.getElementById('bDen').value = 3;
479
+ document.getElementById('op').value = 'add';
480
+ calcResult.style.display = 'none';
481
+ });
482
+
483
+ // keyboard enter trigger for viz inputs
484
+ [vizNum, vizDen].forEach(el=>{
485
+ el.addEventListener('keydown', (e)=>{
486
+ if(e.key === 'Enter') updateViz();
487
+ });
488
+ });
489
+ </script>
490
+ <script src="https://cdn.jsdelivr.net/npm/@arcade-v/arcade_v/navigation/games/loadsite.js"></script>
491
+ </body>
492
+ </html>
493
+
494
+
@@ -0,0 +1,96 @@
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>Addition and Subtraction</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background: #f9f9f9;
11
+ color: #333;
12
+ text-align: center;
13
+ padding: 20px;
14
+ }
15
+ h1 {
16
+ color: #4CAF50;
17
+ }
18
+ h2 {
19
+ color: #2196F3;
20
+ }
21
+ .example {
22
+ background: #fff;
23
+ padding: 15px;
24
+ margin: 15px auto;
25
+ width: 300px;
26
+ border-radius: 8px;
27
+ box-shadow: 0 2px 6px rgba(0,0,0,0.1);
28
+ }
29
+ input[type="number"] {
30
+ width: 60px;
31
+ padding: 5px;
32
+ margin: 5px;
33
+ text-align: center;
34
+ }
35
+ button {
36
+ background: #4CAF50;
37
+ color: white;
38
+ border: none;
39
+ padding: 8px 12px;
40
+ cursor: pointer;
41
+ border-radius: 4px;
42
+ margin-top: 5px;
43
+ }
44
+ button:hover {
45
+ background: #45a049;
46
+ }
47
+ #result {
48
+ margin-top: 10px;
49
+ font-weight: bold;
50
+ }
51
+ </style>
52
+ </head>
53
+ <body>
54
+
55
+ <h1>Learning Addition and Subtraction</h1>
56
+ <p>Addition means putting numbers together. Subtraction means taking numbers away.</p>
57
+
58
+ <div class="example">
59
+ <h2>Addition</h2>
60
+ <p>Example: 3 + 2 = 5</p>
61
+ <input type="number" id="add1" placeholder="Number">
62
+ +
63
+ <input type="number" id="add2" placeholder="Number">
64
+ <br>
65
+ <button onclick="addNumbers()">Add</button>
66
+ <div id="addResult"></div>
67
+ </div>
68
+
69
+ <div class="example">
70
+ <h2>Subtraction</h2>
71
+ <p>Example: 5 - 2 = 3</p>
72
+ <input type="number" id="sub1" placeholder="Number">
73
+ -
74
+ <input type="number" id="sub2" placeholder="Number">
75
+ <br>
76
+ <button onclick="subtractNumbers()">Subtract</button>
77
+ <div id="subResult"></div>
78
+ </div>
79
+
80
+ <script>
81
+ function addNumbers() {
82
+ let num1 = parseFloat(document.getElementById('add1').value) || 0;
83
+ let num2 = parseFloat(document.getElementById('add2').value) || 0;
84
+ document.getElementById('addResult').innerText = "Result: " + (num1 + num2);
85
+ }
86
+
87
+ function subtractNumbers() {
88
+ let num1 = parseFloat(document.getElementById('sub1').value) || 0;
89
+ let num2 = parseFloat(document.getElementById('sub2').value) || 0;
90
+ document.getElementById('subResult').innerText = "Result: " + (num1 - num2);
91
+ }
92
+ <script src="https://cdn.jsdelivr.net/npm/@arcade-v/arcade_v/navigation/games/loadsite.js"></script>
93
+ </script>
94
+
95
+ </body>
96
+ </html>
@@ -0,0 +1,110 @@
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>Simple Calculator</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background: #f4f4f4;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ height: 100vh;
15
+ }
16
+ .calculator {
17
+ background: #fff;
18
+ padding: 20px;
19
+ border-radius: 10px;
20
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
21
+ width: 250px;
22
+ }
23
+ input[type="text"] {
24
+ width: 100%;
25
+ height: 50px;
26
+ font-size: 18px;
27
+ text-align: right;
28
+ margin-bottom: 10px;
29
+ border: 1px solid #ccc;
30
+ border-radius: 5px;
31
+ padding: 5px;
32
+ }
33
+ .buttons {
34
+ display: grid;
35
+ grid-template-columns: repeat(4, 1fr);
36
+ gap: 10px;
37
+ }
38
+ button {
39
+ height: 50px;
40
+ font-size: 18px;
41
+ border: none;
42
+ border-radius: 5px;
43
+ cursor: pointer;
44
+ background: #f1f1f1;
45
+ transition: background 0.2s;
46
+ }
47
+ button:hover {
48
+ background: #ddd;
49
+ }
50
+ .equal {
51
+ background: #4CAF50;
52
+ color: white;
53
+ }
54
+ .equal:hover {
55
+ background: #45a049;
56
+ }
57
+ </style>
58
+ </head>
59
+ <body>
60
+ <div class="calculator">
61
+ <input type="text" id="display" disabled>
62
+ <div class="buttons">
63
+ <button onclick="clearDisplay()">C</button>
64
+ <button onclick="appendValue('/')">/</button>
65
+ <button onclick="appendValue('*')">*</button>
66
+ <button onclick="appendValue('-')">-</button>
67
+
68
+ <button onclick="appendValue('7')">7</button>
69
+ <button onclick="appendValue('8')">8</button>
70
+ <button onclick="appendValue('9')">9</button>
71
+ <button onclick="appendValue('+')">+</button>
72
+
73
+ <button onclick="appendValue('4')">4</button>
74
+ <button onclick="appendValue('5')">5</button>
75
+ <button onclick="appendValue('6')">6</button>
76
+ <button onclick="calculate()" class="equal">=</button>
77
+
78
+ <button onclick="appendValue('1')">1</button>
79
+ <button onclick="appendValue('2')">2</button>
80
+ <button onclick="appendValue('3')">3</button>
81
+ <button onclick="appendValue('0')">0</button>
82
+
83
+ <button onclick="appendValue('.')">.</button>
84
+ </div>
85
+ </div>
86
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
87
+ <script>
88
+ let display = document.getElementById('display');
89
+
90
+ function appendValue(value) {
91
+ display.value += value;
92
+ }
93
+
94
+ function clearDisplay() {
95
+ display.value = '';
96
+ }
97
+
98
+ function calculate() {
99
+ try {
100
+ display.value = eval(display.value);
101
+ } catch {
102
+ display.value = 'Error';
103
+ }
104
+ }
105
+ </script>
106
+ <script src="https://cdn.jsdelivr.net/npm/@arcade-v/arcade_v/navigation/games/loadsite.js"></script>
107
+ </body>
108
+ </html>
109
+
110
+