awacke1 commited on
Commit
2a82fa9
·
1 Parent(s): 9400106

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +122 -18
index.html CHANGED
@@ -1,19 +1,123 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Animal Emoji Slot Machine</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ text-align: center;
11
+ }
12
+ #slot-machine {
13
+ display: inline-block;
14
+ border: 3px solid #ccc;
15
+ padding: 20px;
16
+ border-radius: 10px;
17
+ }
18
+ .line {
19
+ display: flex;
20
+ justify-content: center;
21
+ align-items: center;
22
+ margin-bottom: 10px;
23
+ }
24
+ .slot {
25
+ padding: 0 10px;
26
+ font-size: 2rem;
27
+ }
28
+ button {
29
+ font-size: 1rem;
30
+ padding: 10px 20px;
31
+ margin-top: 20px;
32
+ }
33
+ #balance {
34
+ font-size: 1.25rem;
35
+ margin-top: 10px;
36
+ }
37
+ #history {
38
+ font-size: 1rem;
39
+ margin-top: 10px;
40
+ }
41
+ </style>
42
+ </head>
43
+ <body>
44
+ <h1>Animal Emoji Slot Machine</h1>
45
+ <div id="slot-machine">
46
+ <div class="line">
47
+ <div class="slot" id="slot1-1">🐶</div>
48
+ <div class="slot" id="slot1-2">🐶</div>
49
+ <div class="slot" id="slot1-3">🐶</div>
50
+ <div class="slot" id="slot1-4">🐶</div>
51
+ <div class="slot" id="slot1-5">🐶</div>
52
+ </div>
53
+ <div class="line">
54
+ <div class="slot" id="slot2-1">🐶</div>
55
+ <div class="slot" id="slot2-2">🐶</div>
56
+ <div class="slot" id="slot2-3">🐶</div>
57
+ <div class="slot" id="slot2-4">🐶</div>
58
+ <div class="slot" id="slot2-5">🐶</div>
59
+ </div>
60
+ <div class="line">
61
+ <div class="slot" id="slot3-1">🐶</div>
62
+ <div class="slot" id="slot3-2">🐶</div>
63
+ <div class="slot" id="slot3-3">🐶</div>
64
+ <div class="slot" id="slot3-4">🐶</div>
65
+ <div class="slot" id="slot3-5">🐶</div>
66
+ </div>
67
+ <div class="line">
68
+ <div class="slot" id="slot4-1">🐶</div>
69
+ <div class="slot" id="slot4-2">🐶</div>
70
+ <div class="slot" id="slot4-3">🐶</div>
71
+ <div class="slot" id="slot4-4">🐶</div>
72
+ <div class="slot" id="slot4-5">🐶</div>
73
+ </div>
74
+ </div>
75
+ <button id="spin-btn">Spin</button>
76
+ <div id="balance">Balance: $<span id="balance-amount">10.00</span></div>
77
+ <div id="history"></div>
78
+ <script>
79
+ function countMatches(line) {
80
+ const counts = {};
81
+ for (const emoji of line) {
82
+ counts[emoji] = (counts[emoji] || 0) + 1;
83
+ }
84
+ return Math.max(...Object.values(counts));
85
+ }
86
+ document.getElementById('spin-btn').addEventListener('click', function () {
87
+ var emojis = ['🐶', '🐱', '🐰', '🦁', '🐯', '🐸', '🐵', '🦊', '🦄', '🦓'];
88
+ var balanceAmount = document.getElementById('balance-amount');
89
+ var history = document.getElementById('history');
90
+ var winAmount = 0;
91
+ // Deduct 50 cents
92
+ var newBalance = parseFloat(balanceAmount.textContent) - 0.50;
93
+ if (newBalance < 0) {
94
+ alert("Insufficient balance.");
95
+ return;
96
+ }
97
+ balanceAmount.textContent = newBalance.toFixed(2);
98
+ for (let row = 1; row <= 4; row++) {
99
+ const line = [];
100
+ for (let col = 1; col <= 5; col++) {
101
+ const emoji = emojis[Math.floor(Math.random() * emojis.length)];
102
+ line.push(emoji);
103
+ document.getElementById(slot${row}-${col}).textContent = emoji;
104
+ }
105
+ const matches = countMatches(line);
106
+ if (matches === 3) {
107
+ winAmount += .25;
108
+ } else if (matches === 4) {
109
+ winAmount += 5;
110
+ } else if (matches === 5) {
111
+ winAmount += 20;
112
+ }
113
+ }
114
+ if (winAmount > 0) {
115
+ newBalance = parseFloat(balanceAmount.textContent) + winAmount;
116
+ balanceAmount.textContent = newBalance.toFixed(2);
117
+ history.innerHTML += '<p>You won $' + winAmount + '! 🎉</p>';
118
+ }
119
+ });
120
+ </script>
121
+
122
+ </body>
123
+ </html>