trd69 commited on
Commit
38103a1
·
verified ·
1 Parent(s): f1e0f83

оптимизируй код, но сохрани весь функционал. обязательно сохрани функционал - Follow Up Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1026 -19
  3. prompts.txt +3 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Cps
3
- emoji: 🚀
4
- colorFrom: indigo
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: cps
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: pink
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1026 @@
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>Chinese Poker Solver</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ .card {
10
+ width: 70px;
11
+ height: 105px;
12
+ border-radius: 5px;
13
+ display: flex;
14
+ flex-direction: column;
15
+ justify-content: space-between;
16
+ padding: 5px;
17
+ cursor: grab;
18
+ user-select: none;
19
+ position: relative;
20
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
21
+ transition: transform 0.2s, box-shadow 0.2s;
22
+ }
23
+
24
+ .card:hover {
25
+ transform: translateY(-5px);
26
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
27
+ }
28
+
29
+ .card-red {
30
+ background-color: white;
31
+ color: red;
32
+ }
33
+
34
+ .card-black {
35
+ background-color: white;
36
+ color: black;
37
+ }
38
+
39
+ .card-blue {
40
+ background-color: white;
41
+ color: blue;
42
+ }
43
+
44
+ .card-green {
45
+ background-color: white;
46
+ color: green;
47
+ }
48
+
49
+ .card-value {
50
+ font-size: 16px;
51
+ font-weight: bold;
52
+ text-align: center;
53
+ }
54
+
55
+ .card-suit {
56
+ font-size: 18px;
57
+ align-self: center;
58
+ }
59
+
60
+ .card-symbol {
61
+ font-size: 10px;
62
+ position: absolute;
63
+ top: 1px;
64
+ left: 2px;
65
+ }
66
+
67
+ .slot {
68
+ width: 60px;
69
+ height: 90px;
70
+ border: 2px dashed #4B5563;
71
+ border-radius: 5px;
72
+ display: flex;
73
+ justify-content: center;
74
+ align-items: center;
75
+ background-color: rgba(75, 85, 99, 0.2);
76
+ }
77
+
78
+ .slot:hover {
79
+ background-color: rgba(75, 85, 99, 0.4);
80
+ }
81
+
82
+ .opponent-row {
83
+ opacity: 0.8;
84
+ }
85
+
86
+ .combination-label {
87
+ font-size: 12px;
88
+ color: #9CA3AF;
89
+ margin-left: 10px;
90
+ align-self: center;
91
+ }
92
+
93
+ .points-label {
94
+ font-size: 12px;
95
+ color: #FBBF24;
96
+ font-weight: bold;
97
+ margin-left: 10px;
98
+ align-self: center;
99
+ }
100
+
101
+ .row-container {
102
+ display: flex;
103
+ align-items: center;
104
+ }
105
+
106
+ .deck-slot {
107
+ width: 60px;
108
+ height: 90px;
109
+ margin: 0;
110
+ padding: 4px;
111
+ position: relative;
112
+ background-color: white;
113
+ border-radius: 5px;
114
+ display: flex;
115
+ flex-direction: column;
116
+ justify-content: space-between;
117
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
118
+ }
119
+
120
+ @media (max-width: 768px) {
121
+ .card {
122
+ width: 50px;
123
+ height: 75px;
124
+ }
125
+
126
+ .slot {
127
+ width: 40px;
128
+ height: 60px;
129
+ }
130
+
131
+ .card-value {
132
+ font-size: 14px;
133
+ }
134
+
135
+ .card-suit {
136
+ font-size: 16px;
137
+ }
138
+
139
+ .card-symbol {
140
+ font-size: 8px;
141
+ }
142
+
143
+ }
144
+ </style>
145
+ </head>
146
+ <body class="bg-gray-900 text-white min-h-screen p-4">
147
+ <div class="container mx-auto max-w-6xl">
148
+ <h1 class="text-3xl font-bold text-center mb-6 text-yellow-300">Chinese Poker Solver</h1>
149
+
150
+ <!-- Buttons -->
151
+ <div class="flex flex-wrap justify-center gap-4 mb-8">
152
+ <button id="calculate-btn" class="px-6 py-3 bg-green-600 hover:bg-green-700 rounded-lg font-semibold disabled:opacity-50 disabled:cursor-not-allowed transition">
153
+ Calculate Best Moves
154
+ </button>
155
+ <button id="reset-btn" class="px-6 py-3 bg-red-600 hover:bg-red-700 rounded-lg font-semibold transition">
156
+ Reset All Cards
157
+ </button>
158
+ </div>
159
+
160
+ <!-- Game Boards Container -->
161
+ <div class="flex flex-row gap-8 mb-0">
162
+ <!-- Opponent's Board aligned left -->
163
+ <div class="w-[300px]">
164
+ <h2 class="text-xl font-semibold mb-4 text-gray-400">Opponent's Rows</h2>
165
+
166
+ <!-- Opponent's Top Row (3 cards) -->
167
+ <div class="row-container mb-2 opponent-row">
168
+ <div class="flex gap-2">
169
+ <div id="opponent-top-0" class="slot" data-row="opponent-top"></div>
170
+ <div id="opponent-top-1" class="slot" data-row="opponent-top"></div>
171
+ <div id="opponent-top-2" class="slot" data-row="opponent-top"></div>
172
+ </div>
173
+ <div class="combination-label" id="opponent-top-combination">-</div>
174
+ <div class="points-label" id="opponent-top-points">0</div>
175
+ </div>
176
+
177
+ <!-- Opponent's Middle Row (5 cards) -->
178
+ <div class="row-container mb-6 opponent-row">
179
+ <div class="flex justify-center items-end gap-2">
180
+ <div id="opponent-middle-0" class="slot" data-row="opponent-middle"></div>
181
+ <div id="opponent-middle-1" class="slot" data-row="opponent-middle"></div>
182
+ <div id="opponent-middle-2" class="slot" data-row="opponent-middle"></div>
183
+ <div id="opponent-middle-3" class="slot" data-row="opponent-middle"></div>
184
+ <div id="opponent-middle-4" class="slot" data-row="opponent-middle"></div>
185
+ </div>
186
+ <div class="combination-label" id="opponent-middle-combination">-</div>
187
+ <div class="points-label" id="opponent-middle-points">0</div>
188
+ </div>
189
+
190
+ <!-- Opponent's Bottom Row (5 cards) -->
191
+ <div class="row-container opponent-row">
192
+ <div class="flex justify-center items-end gap-2">
193
+ <div id="opponent-bottom-0" class="slot" data-row="opponent-bottom"></div>
194
+ <div id="opponent-bottom-1" class="slot" data-row="opponent-bottom"></div>
195
+ <div id="opponent-bottom-2" class="slot" data-row="opponent-bottom"></div>
196
+ <div id="opponent-bottom-3" class="slot" data-row="opponent-bottom"></div>
197
+ <div id="opponent-bottom-4" class="slot" data-row="opponent-bottom"></div>
198
+ </div>
199
+ <div class="combination-label" id="opponent-bottom-combination">-</div>
200
+ <div class="points-label" id="opponent-bottom-points">0</div>
201
+ </div>
202
+
203
+ </div> <!-- End player's board -->
204
+ </div> <!-- End game boards container -->
205
+
206
+ <!-- Player's Board -->
207
+ <div class="w-[300px]">
208
+ <h2 class="text-xl font-semibold mb-4">Your Rows</h2>
209
+
210
+ <!-- Player's Top Row (3 cards) -->
211
+ <div class="row-container mb-2">
212
+ <div class="flex gap-2">
213
+ <div id="player-top-0" class="slot" data-row="player-top"></div>
214
+ <div id="player-top-1" class="slot" data-row="player-top"></div>
215
+ <div id="player-top-2" class="slot" data-row="player-top"></div>
216
+ </div>
217
+ <div class="combination-label" id="player-top-combination">-</div>
218
+ <div class="points-label" id="player-top-points">0</div>
219
+ </div>
220
+
221
+ <!-- Player's Middle Row (5 cards) -->
222
+ <div class="row-container mb-2">
223
+ <div class="flex justify-center gap-2">
224
+ <div id="player-middle-0" class="slot" data-row="player-middle"></div>
225
+ <div id="player-middle-1" class="slot" data-row="player-middle"></div>
226
+ <div id="player-middle-2" class="slot" data-row="player-middle"></div>
227
+ <div id="player-middle-3" class="slot" data-row="player-middle"></div>
228
+ <div id="player-middle-4" class="slot" data-row="player-middle"></div>
229
+ </div>
230
+ <div class="combination-label" id="player-middle-combination">-</div>
231
+ <div class="points-label" id="player-middle-points">0</div>
232
+ </div>
233
+
234
+ <!-- Player's Bottom Row (5 cards) -->
235
+ <div class="row-container mb-8">
236
+ <div class="flex justify-center gap-2">
237
+ <div id="player-bottom-0" class="slot" data-row="player-bottom"></div>
238
+ <div id="player-bottom-1" class="slot" data-row="player-bottom"></div>
239
+ <div id="player-bottom-2" class="slot" data-row="player-bottom"></div>
240
+ <div id="player-bottom-3" class="slot" data-row="player-bottom"></div>
241
+ <div id="player-bottom-4" class="slot" data-row="player-bottom"></div>
242
+ </div>
243
+ <div class="combination-label" id="player-bottom-combination">-</div>
244
+ <div class="points-label" id="player-bottom-points">0</div>
245
+ </div>
246
+ </div>
247
+ </div> <!-- End game boards container -->
248
+
249
+ <!-- Player's Hand and Discard side by side -->
250
+ <div class="flex flex-row gap-6 mt-6">
251
+ <!-- Player's Hand (5 cards) -->
252
+ <div class="bg-gray-800 rounded-lg p-6 flex-1">
253
+ <h2 class="text-xl font-semibold mb-4">Your Hand</h2>
254
+ <div class="flex justify-center gap-2">
255
+ <div id="hand-0" class="slot" data-row="hand"></div>
256
+ <div id="hand-1" class="slot" data-row="hand"></div>
257
+ <div id="hand-2" class="slot" data-row="hand"></div>
258
+ <div id="hand-3" class="slot" data-row="hand"></div>
259
+ <div id="hand-4" class="slot" data-row="hand"></div>
260
+ </div>
261
+ </div>
262
+
263
+ <!-- Discard Area (3 cards) -->
264
+ <div class="bg-gray-800 rounded-lg p-6 flex-1">
265
+ <h2 class="text-xl font-semibold mb-4">Discard</h2>
266
+ <div class="flex justify-center gap-2">
267
+ <div id="discard-0" class="slot" data-row="discard"></div>
268
+ <div id="discard-1" class="slot" data-row="discard"></div>
269
+ <div id="discard-2" class="slot" data-row="discard"></div>
270
+ </div>
271
+ </div>
272
+ </div>
273
+
274
+ <!-- Right-side container for deck -->
275
+ <div class="absolute right-8 top-32 mr-4" style="width: 600px; height: 500px;">
276
+ <!-- Deck -->
277
+ <div class="bg-gray-800 rounded-lg p-2 h-full overflow-y-auto">
278
+ <h2 class="text-xl font-semibold mb-4">Deck</h2>
279
+ <div class="grid grid-cols-8 gap-2 h-[calc(100%-48px)] overflow-y-auto">
280
+ <!-- Cards will be generated here -->
281
+ </div>
282
+ </div>
283
+ </div>
284
+
285
+
286
+ <!-- Results -->
287
+ <div id="results" class="bg-gray-800 rounded-lg p-6 hidden">
288
+ <h2 class="text-xl font-semibold mb-4">Best Moves</h2>
289
+ <div id="results-content" class="grid gap-4">
290
+ <!-- Results will be shown here -->
291
+ </div>
292
+ </div>
293
+
294
+ <!-- Score Summary -->
295
+ <div id="score-summary" class="bg-gray-800 rounded-lg p-6 hidden">
296
+ <h2 class="text-xl font-semibold mb-4">Score Summary</h2>
297
+ <div id="score-content" class="grid gap-2">
298
+ <div class="bg-gray-700 p-4 rounded-lg">
299
+ <h3 class="font-semibold text-center mb-2">Final Score</h3>
300
+ <div class="flex justify-between">
301
+ <div class="text-green-400">
302
+ <p class="font-bold">You:</p>
303
+ <p>Top: <span id="final-player-top"></span></p>
304
+ <p>Middle: <span id="final-player-middle"></span></p>
305
+ <p>Bottom: <span id="final-player-bottom"></span></p>
306
+ <p class="font-bold text-lg mt-2">Total: <span id="final-player-score">0</span></p>
307
+ </div>
308
+ <div class="text-red-400 text-right">
309
+ <p class="font-bold">Opponent:</p>
310
+ <p>Top: <span id="final-opponent-top"></span></p>
311
+ <p>Middle: <span id="final-opponent-middle"></span></p>
312
+ <p>Bottom: <span id="final-opponent-bottom"></span></p>
313
+ <p class="font-bold text-lg mt-2">Total: <span id="final-opponent-score">0</span></p>
314
+ </div>
315
+ </div>
316
+ </div>
317
+ </div>
318
+ </div>
319
+ </div>
320
+
321
+ <script>
322
+ document.addEventListener('DOMContentLoaded', function() {
323
+ // Game state
324
+ const gameState = {
325
+ cards: [],
326
+ slots: {},
327
+ cardPositions: {}, // Tracks which card is in which slot
328
+ lastMoveValid: false
329
+ };
330
+
331
+ // Initialize all slots
332
+ function initializeSlots() {
333
+ // Opponent's slots
334
+ for (let i = 0; i < 3; i++) {
335
+ gameState.slots[`opponent-top-${i}`] = null;
336
+ }
337
+ for (let i = 0; i < 5; i++) {
338
+ gameState.slots[`opponent-middle-${i}`] = null;
339
+ gameState.slots[`opponent-bottom-${i}`] = null;
340
+ }
341
+
342
+ // Player's hand and discard
343
+ for (let i = 0; i < 5; i++) {
344
+ gameState.slots[`hand-${i}`] = null;
345
+ }
346
+ for (let i = 0; i < 3; i++) {
347
+ gameState.slots[`discard-${i}`] = null;
348
+ }
349
+
350
+ // Player's slots
351
+ for (let i = 0; i < 3; i++) {
352
+ gameState.slots[`player-top-${i}`] = null;
353
+ }
354
+ for (let i = 0; i < 5; i++) {
355
+ gameState.slots[`player-middle-${i}`] = null;
356
+ gameState.slots[`player-bottom-${i}`] = null;
357
+ }
358
+
359
+ // Deck slots (will be initialized with cards)
360
+ }
361
+
362
+ // Create a standard deck of 52 cards
363
+ function createDeck() {
364
+ const suits = {
365
+ 'hearts': { symbol: '♥', class: 'card-red' },
366
+ 'diamonds': { symbol: '♦', class: 'card-blue' },
367
+ 'clubs': { symbol: '♣', class: 'card-green' },
368
+ 'spades': { symbol: '♠', class: 'card-black' }
369
+ };
370
+
371
+ const values = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'];
372
+
373
+ let deck = [];
374
+ let id = 0;
375
+
376
+ for (const [suit, suitInfo] of Object.entries(suits)) {
377
+ for (const [index, value] of values.entries()) {
378
+ deck.push({
379
+ id: id++,
380
+ suit: suit,
381
+ suitSymbol: suitInfo.symbol,
382
+ suitClass: suitInfo.class,
383
+ value: value,
384
+ rank: index + 2, // 2 is lowest, Ace is highest
385
+ element: null
386
+ });
387
+ }
388
+ }
389
+
390
+ return deck;
391
+ }
392
+
393
+ // Render the deck
394
+ function renderDeck() {
395
+ const deckContainer = document.querySelector('.grid.gap-2');
396
+ deckContainer.innerHTML = '';
397
+
398
+ gameState.cards.forEach(card => {
399
+ const cardElement = document.createElement('div');
400
+ cardElement.className = `deck-card ${card.suitClass} deck-slot`;
401
+ cardElement.setAttribute('draggable', 'true');
402
+ cardElement.dataset.cardId = card.id;
403
+
404
+ cardElement.innerHTML = `
405
+ <div class="card-symbol">${card.suitSymbol}</div>
406
+ <div class="card-value text-center">${card.value}</div>
407
+ <div class="card-suit">${card.suitSymbol}</div>
408
+ `;
409
+
410
+ cardElement.addEventListener('dragstart', handleDragStart);
411
+
412
+ deckContainer.appendChild(cardElement);
413
+ card.element = cardElement;
414
+ gameState.cardPositions[card.id] = 'deck';
415
+ });
416
+ }
417
+
418
+ // Handle drag start
419
+ function handleDragStart(e) {
420
+ e.dataTransfer.setData('text/plain', e.target.dataset.cardId);
421
+ e.dataTransfer.effectAllowed = 'move';
422
+ }
423
+
424
+ // Set up drop zones
425
+ function setupDropZones() {
426
+ const slots = document.querySelectorAll('.slot');
427
+
428
+ slots.forEach(slot => {
429
+ slot.addEventListener('dragover', function(e) {
430
+ e.preventDefault();
431
+ e.dataTransfer.dropEffect = 'move';
432
+ });
433
+
434
+ slot.addEventListener('drop', function(e) {
435
+ e.preventDefault();
436
+ const cardId = e.dataTransfer.getData('text/plain');
437
+ moveCard(cardId, slot.id);
438
+ });
439
+ });
440
+ }
441
+
442
+ // Move card from one slot to another
443
+ function moveCard(cardId, toSlotId) {
444
+ const card = gameState.cards.find(c => c.id == cardId);
445
+ if (!card) return;
446
+
447
+ // Remove card from its current position
448
+ const fromPosition = gameState.cardPositions[cardId];
449
+ if (fromPosition && fromPosition !== 'deck') {
450
+ gameState.slots[fromPosition] = null;
451
+ }
452
+
453
+ // Check if target slot is already occupied
454
+ if (gameState.slots[toSlotId]) {
455
+ const otherCardId = gameState.slots[toSlotId];
456
+ gameState.slots[fromPosition] = otherCardId;
457
+ gameState.cardPositions[otherCardId] = fromPosition || 'deck';
458
+
459
+ // Move the other card visually back to its original position
460
+ if (fromPosition) {
461
+ const otherSlot = document.getElementById(fromPosition);
462
+ if (otherSlot) {
463
+ otherSlot.innerHTML = '';
464
+ otherSlot.appendChild(gameState.cards.find(c => c.id == otherCardId).element);
465
+ }
466
+ } else {
467
+ // Return to deck
468
+ const deckContainer = document.querySelector('.grid.gap-2');
469
+ deckContainer.appendChild(gameState.cards.find(c => c.id == otherCardId).element);
470
+ }
471
+ }
472
+
473
+ // Add card to new position
474
+ gameState.slots[toSlotId] = card.id;
475
+ gameState.cardPositions[cardId] = toSlotId;
476
+
477
+ // Update UI
478
+ const toSlot = document.getElementById(toSlotId);
479
+ if (toSlot) {
480
+ toSlot.innerHTML = '';
481
+ toSlot.appendChild(card.element);
482
+ }
483
+
484
+ // Check if we have a valid game state for calculation
485
+ checkGameState();
486
+ }
487
+
488
+ // Check if game state is valid for calculation
489
+ function checkGameState() {
490
+ const calculateBtn = document.getElementById('calculate-btn');
491
+
492
+ // Count cards in different areas
493
+ const handCards = Object.values(gameState.slots).filter(
494
+ v => v !== null && gameState.cardPositions[v]?.startsWith('hand-')
495
+ ).length;
496
+
497
+ const playerCards = Object.values(gameState.slots).filter(
498
+ v => v !== null && gameState.cardPositions[v]?.startsWith('player-')
499
+ ).length;
500
+
501
+ const opponentCards = Object.values(gameState.slots).filter(
502
+ v => v !== null && gameState.cardPositions[v]?.startsWith('opponent-')
503
+ ).length;
504
+
505
+ const discardCards = Object.values(gameState.slots).filter(
506
+ v => v !== null && gameState.cardPositions[v]?.startsWith('discard-')
507
+ ).length;
508
+
509
+ // Valid game states for calculation
510
+ const isValidState = (
511
+ (handCards === 5 && playerCards === 0 && opponentCards === 0 && discardCards === 0) || // First round
512
+ (handCards === 3 && playerCards === 5 && opponentCards === 5 && discardCards === 0) || // Second phase
513
+ (handCards === 3 && playerCards === 7 && opponentCards === 7 && discardCards === 1) || // Third phase
514
+ (handCards === 3 && playerCards === 9 && opponentCards === 9 && discardCards === 2) || // Fourth phase
515
+ (handCards === 3 && playerCards === 11 && opponentCards === 11 && discardCards === 3) // Final phase
516
+ );
517
+
518
+ // All cards placed - show final scores
519
+ if (opponentCards === 13 && playerCards === 13) {
520
+ const resultsContainer = document.getElementById('score-summary');
521
+ const playerTopCombo = document.getElementById('player-top-combination').textContent;
522
+ const playerMiddleCombo = document.getElementById('player-middle-combination').textContent;
523
+ const playerBottomCombo = document.getElementById('player-bottom-combination').textContent;
524
+
525
+ const opponentTopCombo = document.getElementById('opponent-top-combination').textContent;
526
+ const opponentMiddleCombo = document.getElementById('opponent-middle-combination').textContent;
527
+ const opponentBottomCombo = document.getElementById('opponent-bottom-combination').textContent;
528
+
529
+ // Display results
530
+ document.getElementById('final-player-top').textContent = `${playerTopCombo} (${document.getElementById('player-top-points').textContent} pts)`;
531
+ document.getElementById('final-player-middle').textContent = `${playerMiddleCombo} (${document.getElementById('player-middle-points').textContent} pts)`;
532
+ document.getElementById('final-player-bottom').textContent = `${playerBottomCombo} (${document.getElementById('player-bottom-points').textContent} pts)`;
533
+
534
+ document.getElementById('final-opponent-top').textContent = `${opponentTopCombo} (${document.getElementById('opponent-top-points').textContent} pts)`;
535
+ document.getElementById('final-opponent-middle').textContent = `${opponentMiddleCombo} (${document.getElementById('opponent-middle-points').textContent} pts)`;
536
+ document.getElementById('final-opponent-bottom').textContent = `${opponentBottomCombo} (${document.getElementById('opponent-bottom-points').textContent} pts)`;
537
+
538
+ // Calculate final score (simplified for demo)
539
+ const playerScore =
540
+ parseInt(document.getElementById('player-top-points').textContent) +
541
+ parseInt(document.getElementById('player-middle-points').textContent) +
542
+ parseInt(document.getElementById('player-bottom-points').textContent);
543
+ const opponentScore =
544
+ parseInt(document.getElementById('opponent-top-points').textContent) +
545
+ parseInt(document.getElementById('opponent-middle-points').textContent) +
546
+ parseInt(document.getElementById('opponent-bottom-points').textContent);
547
+
548
+ document.getElementById('final-player-score').textContent = playerScore;
549
+ document.getElementById('final-opponent-score').textContent = opponentScore;
550
+
551
+ resultsContainer.classList.remove('hidden');
552
+ calculateBtn.disabled = true;
553
+ gameState.lastMoveValid = true;
554
+ }
555
+ else if (isValidState) {
556
+ calculateBtn.disabled = false;
557
+ gameState.lastMoveValid = true;
558
+ }
559
+ else {
560
+ calculateBtn.disabled = true;
561
+ gameState.lastMoveValid = false;
562
+ }
563
+
564
+ // Update combination labels
565
+ updateCombinationLabels();
566
+ }
567
+
568
+ // Update combination labels for all rows
569
+ function updateCombinationLabels() {
570
+ // Player's rows
571
+ updateRowCombination('player-top', 3);
572
+ updateRowCombination('player-middle', 5);
573
+ updateRowCombination('player-bottom', 5);
574
+
575
+ // Opponent's rows
576
+ updateRowCombination('opponent-top', 3);
577
+ updateRowCombination('opponent-middle', 5);
578
+ updateRowCombination('opponent-bottom', 5);
579
+ }
580
+
581
+ // Update combination label for a specific row
582
+ function updateRowCombination(prefix, size) {
583
+ const cardIds = [];
584
+ for (let i = 0; i < size; i++) {
585
+ const cardId = gameState.slots[`${prefix}-${i}`];
586
+ if (cardId !== null) {
587
+ cardIds.push(gameState.cards.find(c => c.id == cardId));
588
+ }
589
+ }
590
+
591
+ if (cardIds.length < size) {
592
+ document.getElementById(`${prefix}-combination`).textContent = '-';
593
+ document.getElementById(`${prefix}-points`).textContent = '0';
594
+ return;
595
+ }
596
+
597
+ const combination = evaluateCombination(cardIds, prefix.split('-')[0]);
598
+ document.getElementById(`${prefix}-combination`).textContent = combination.name;
599
+ document.getElementById(`${prefix}-points`).textContent = combination.points;
600
+ }
601
+
602
+ // Evaluate combination for a set of cards
603
+ function evaluateCombination(cards, rowType) {
604
+ // Sort cards by rank (high to low)
605
+ cards.sort((a, b) => b.rank - a.rank);
606
+
607
+ // For Chinese Poker different rows have different combinations:
608
+ if (rowType === 'top') {
609
+ // Top row: only simple 3-card combinations (no flushes/straights)
610
+ return evaluateTopRow(cards);
611
+ } else if (rowType === 'middle' || rowType === 'bottom') {
612
+ // Middle/Bottom rows: standard 5-card poker hands
613
+ return evaluateFiveCardHand(cards);
614
+ } else {
615
+ // For other rows (like opponent's) default to simple evaluation
616
+ if (cards.length === 3) {
617
+ return evaluateTopRow(cards);
618
+ } else if (cards.length === 5) {
619
+ return evaluateFiveCardHand(cards);
620
+ }
621
+ return { name: 'Unknown', points: 0 };
622
+ }
623
+ }
624
+
625
+ // Evaluate top row (3 cards)
626
+ function evaluateTopRow(cards) {
627
+ cards.sort((a, b) => b.rank - a.rank); // Sort descending
628
+
629
+ const ranks = cards.map(c => c.rank);
630
+
631
+ // Three of a kind (set)
632
+ if (ranks[0] === ranks[1] && ranks[1] === ranks[2]) {
633
+ return {
634
+ name: `Three ${cards[0].value}'s`,
635
+ points: cards[0].rank // Points equal to card rank (2=2, A=14)
636
+ };
637
+ }
638
+
639
+ // Pair
640
+ if (ranks[0] === ranks[1] || ranks[1] === ranks[2]) {
641
+ const pairRank = ranks[0] === ranks[1] ? ranks[0] : ranks[1];
642
+
643
+ return {
644
+ name: `Pair of ${cards[0].value}'s`,
645
+ points: Math.floor(pairRank / 2) // Simple point scale (2=1, A=7)
646
+ };
647
+ }
648
+
649
+ // High card (single card)
650
+ return {
651
+ name: `High ${cards[0].value}`,
652
+ points: 0
653
+ };
654
+ }
655
+
656
+ // Evaluate 5-card hand (middle or bottom row)
657
+ function evaluateFiveCardHand(cards) {
658
+ // For now we'll implement basic poker hands
659
+
660
+ // Check flush
661
+ const isFlush = cards.every(c => c.suit === cards[0].suit);
662
+
663
+ // Check straight
664
+ let isStraight = true;
665
+ for (let i = 1; i < cards.length; i++) {
666
+ if (cards[i].rank !== cards[i-1].rank - 1) {
667
+ isStraight = false;
668
+ break;
669
+ }
670
+ }
671
+
672
+ // Check wheel (A-2-3-4-5)
673
+ const wheelRanks = [12, 0, 1, 2, 3];
674
+ const currentRanks = cards.map(c => c.rank).sort((a,b) => a-b);
675
+ let isWheel = true;
676
+ for (let i = 0; i < wheelRanks.length; i++) {
677
+ if (currentRanks[i] !== wheelRanks[i]) {
678
+ isWheel = false;
679
+ break;
680
+ }
681
+ }
682
+ isStraight = isStraight || isWheel;
683
+
684
+ // Check royal flush (10-J-Q-K-A of same suit)
685
+ const isRoyal = isFlush &&
686
+ (cards[0].rank === 14) && // Ace
687
+ (cards[1].rank === 13) && // King
688
+ (cards[2].rank === 12) && // Queen
689
+ (cards[3].rank === 11) && // Jack
690
+ (cards[4].rank === 10); // 10
691
+
692
+ // Check straight flush and royal flush
693
+ if (isStraight && isFlush) {
694
+ if (isRoyal) {
695
+ return { name: 'Royal Flush', points: 15 };
696
+ }
697
+ return { name: 'Straight Flush', points: 10 };
698
+ }
699
+
700
+ // Check four of a kind
701
+ const rankCounts = {};
702
+ cards.forEach(c => {
703
+ rankCounts[c.rank] = (rankCounts[c.rank] || 0) + 1;
704
+ });
705
+ const counts = Object.values(rankCounts);
706
+
707
+ if (counts.includes(4)) {
708
+ return { name: 'Four of a Kind', points: 8 };
709
+ }
710
+
711
+ // Check full house
712
+ if (counts.includes(3) && counts.includes(2)) {
713
+ return { name: 'Full House', points: 6 };
714
+ }
715
+
716
+ // Check flush
717
+ if (isFlush) {
718
+ return { name: 'Flush', points: 4 };
719
+ }
720
+
721
+ // Check straight
722
+ if (isStraight || isWheel) {
723
+ return { name: 'Straight', points: 2 };
724
+ }
725
+
726
+ // Check three of a kind
727
+ if (counts.includes(3)) {
728
+ return { name: 'Three of a Kind', points: 0 };
729
+ }
730
+
731
+ // Check two pairs
732
+ const pairCount = counts.filter(c => c === 2).length;
733
+ if (pairCount === 2) {
734
+ return { name: 'Two Pairs', points: 0 };
735
+ }
736
+
737
+ // Check pair
738
+ if (pairCount === 1) {
739
+ return { name: 'Pair', points: 0 };
740
+ }
741
+
742
+ // High card
743
+ return { name: 'High Card', points: 0 };
744
+ }
745
+
746
+ // Calculate best moves (simplified for demo)
747
+ function calculateBestMoves() {
748
+ // Check if all cards are placed (13 in each)
749
+ const playerCards = Object.values(gameState.slots).filter(
750
+ v => v !== null && gameState.cardPositions[v]?.startsWith('player-')
751
+ ).length;
752
+
753
+ const opponentCards = Object.values(gameState.slots).filter(
754
+ v => v !== null && gameState.cardPositions[v]?.startsWith('opponent-')
755
+ ).length;
756
+
757
+ if (playerCards === 13 && opponentCards === 13) {
758
+ // Show final scores
759
+ showFinalScores();
760
+ return;
761
+ }
762
+
763
+ const resultsContainer = document.getElementById('results');
764
+ const resultsContent = document.getElementById('results-content');
765
+
766
+ resultsContent.innerHTML = '';
767
+
768
+ if (!gameState.lastMoveValid) {
769
+ resultsContent.innerHTML = '<p class="text-red-400">Invalid game state for calculation.</p>';
770
+ resultsContainer.classList.remove('hidden');
771
+ return;
772
+ }
773
+
774
+ // For now, we'll generate random recommendations
775
+ // In a real app, this would use an actual algorithm
776
+
777
+ // Get cards in hand
778
+ const handCardIds = [];
779
+ for (let i = 0; i < 5; i++) {
780
+ const cardId = gameState.slots[`hand-${i}`];
781
+ if (cardId !== null) {
782
+ handCardIds.push(cardId);
783
+ }
784
+ }
785
+
786
+ // Make 3 random recommendations
787
+ for (let i = 0; i < 3; i++) {
788
+ const resultDiv = document.createElement('div');
789
+ resultDiv.className = 'bg-gray-700 p-4 rounded-lg';
790
+
791
+ const header = document.createElement('h3');
792
+ header.className = 'font-semibold text-yellow-300 mb-2';
793
+ header.textContent = `Option ${i+1}`;
794
+
795
+ const evText = document.createElement('p');
796
+ evText.className = 'text-sm mb-2';
797
+ evText.textContent = `Expected Value: ${(Math.random() * 3 + 1).toFixed(2)}`;
798
+
799
+ const movesText = document.createElement('p');
800
+ movesText.className = 'text-sm';
801
+
802
+ // Generate random placement for the hand cards
803
+ handCardIds.forEach(cardId => {
804
+ const randomRow = ['top', 'middle', 'bottom'][Math.floor(Math.random() * 3)];
805
+ let randomSlot;
806
+
807
+ if (randomRow === 'top') {
808
+ randomSlot = `player-top-${Math.floor(Math.random() * 3)}`;
809
+ } else {
810
+ randomSlot = `player-${randomRow}-${Math.floor(Math.random() * 5)}`;
811
+ }
812
+
813
+ const card = gameState.cards.find(c => c.id === cardId);
814
+ movesText.innerHTML += `Place ${card.value}${card.suitSymbol} in ${randomRow} row (slot ${randomSlot.split('-').pop()})<br>`;
815
+ });
816
+
817
+ resultDiv.appendChild(header);
818
+ resultDiv.appendChild(evText);
819
+ resultDiv.appendChild(movesText);
820
+ resultsContent.appendChild(resultDiv);
821
+ }
822
+
823
+ resultsContainer.classList.remove('hidden');
824
+ }
825
+
826
+ // Show final scores when all cards are placed
827
+ function showFinalScores() {
828
+ // Display results
829
+ const playerTopCombo = document.getElementById('player-top-combination').textContent;
830
+ const playerMiddleCombo = document.getElementById('player-middle-combination').textContent;
831
+ const playerBottomCombo = document.getElementById('player-bottom-combination').textContent;
832
+
833
+ const opponentTopCombo = document.getElementById('opponent-top-combination').textContent;
834
+ const opponentMiddleCombo = document.getElementById('opponent-middle-combination').textContent;
835
+ const opponentBottomCombo = document.getElementById('opponent-bottom-combination').textContent;
836
+
837
+ // Get points for each row
838
+ const playerTopPoints = parseInt(document.getElementById('player-top-points').textContent);
839
+ const playerMiddlePoints = parseInt(document.getElementById('player-middle-points').textContent);
840
+ const playerBottomPoints = parseInt(document.getElementById('player-bottom-points').textContent);
841
+
842
+ const opponentTopPoints = parseInt(document.getElementById('opponent-top-points').textContent);
843
+ const opponentMiddlePoints = parseInt(document.getElementById('opponent-middle-points').textContent);
844
+ const opponentBottomPoints = parseInt(document.getElementById('opponent-bottom-points').textContent);
845
+
846
+ // Check for seniority violation (broken hand)
847
+ let playerBrokenHand = false;
848
+ let opponentBrokenHand = false;
849
+
850
+ if (playerMiddlePoints > playerBottomPoints || playerTopPoints > playerMiddlePoints) {
851
+ playerBrokenHand = true;
852
+ alert("You have a broken hand! (Bottom must be strongest, middle stronger than top)");
853
+ }
854
+
855
+ if (opponentMiddlePoints > opponentBottomPoints || opponentTopPoints > opponentMiddlePoints) {
856
+ opponentBrokenHand = true;
857
+ alert("Opponent has a broken hand! (Bottom must be strongest, middle stronger than top)");
858
+ }
859
+
860
+ // Reset scores
861
+ let playerScore = 0;
862
+ let opponentScore = 0;
863
+
864
+ // Apply breaking hand rule - if hand is broken, ALL points are zero including royalties
865
+ if (playerBrokenHand || opponentBrokenHand) {
866
+ playerScore = 0;
867
+ opponentScore = 0;
868
+ } else {
869
+ let playerRowWins = 0;
870
+ let opponentRowWins = 0;
871
+
872
+ // Compare top rows (3 cards)
873
+ if (playerTopPoints > opponentTopPoints) {
874
+ playerScore += 1;
875
+ playerRowWins += 1;
876
+ } else if (playerTopPoints < opponentTopPoints) {
877
+ opponentScore += 1;
878
+ opponentRowWins += 1;
879
+ }
880
+
881
+ // Compare middle rows (5 cards)
882
+ if (playerMiddlePoints > opponentMiddlePoints) {
883
+ playerScore += 1;
884
+ playerRowWins += 1;
885
+ } else if (playerMiddlePoints < opponentMiddlePoints) {
886
+ opponentScore += 1;
887
+ opponentRowWins += 1;
888
+ }
889
+
890
+ // Compare bottom rows (5 cards)
891
+ if (playerBottomPoints > opponentBottomPoints) {
892
+ playerScore += 1;
893
+ playerRowWins += 1;
894
+ } else if (playerBottomPoints < opponentBottomPoints) {
895
+ opponentScore += 1;
896
+ opponentRowWins += 1;
897
+ }
898
+
899
+ // Scoop bonus: +3 for winning all 3 rows
900
+ if (playerRowWins === 3) {
901
+ playerScore += 3;
902
+ } else if (opponentRowWins === 3) {
903
+ opponentScore += 3;
904
+ }
905
+
906
+ // Add royalties as additional points (if no broken hand)
907
+ const playerRoyalty = calculateRoyaltyPoints(playerTopCombo, 'top') +
908
+ calculateRoyaltyPoints(playerMiddleCombo, 'middle') +
909
+ calculateRoyaltyPoints(playerBottomCombo, 'bottom');
910
+ playerScore += playerRoyalty;
911
+
912
+ const opponentRoyalty = calculateRoyaltyPoints(opponentTopCombo, 'top') +
913
+ calculateRoyaltyPoints(opponentMiddleCombo, 'middle') +
914
+ calculateRoyaltyPoints(opponentBottomCombo, 'bottom');
915
+ opponentScore += opponentRoyalty;
916
+ }
917
+
918
+ function calculateRoyaltyPoints(combo, rowType) {
919
+ let points = 0;
920
+ const comboStr = combo.toLowerCase();
921
+
922
+ // Top row royalties
923
+ if (rowType === 'top') {
924
+ if (comboStr.includes('three')) points += 3;
925
+ else if (comboStr.includes('pair')) points += 1;
926
+ }
927
+ // Middle row royalties
928
+ else if (rowType === 'middle') {
929
+ if (comboStr.includes('royal flush')) points += 15;
930
+ else if (comboStr.includes('straight flush')) points += 10;
931
+ else if (comboStr.includes('four of')) points += 8;
932
+ else if (comboStr.includes('full house')) points += 4;
933
+ }
934
+ // Bottom row royalties
935
+ else if (rowType === 'bottom') {
936
+ if (comboStr.includes('royal flush')) points += 25;
937
+ else if (comboStr.includes('straight flush')) points += 15;
938
+ else if (comboStr.includes('four of')) points += 10;
939
+ else if (comboStr.includes('full house')) points += 6;
940
+ else if (comboStr.includes('flush')) points += 4;
941
+ else if (comboStr.includes('straight')) points += 2;
942
+ }
943
+
944
+ return points;
945
+ }
946
+
947
+ // Display final scores
948
+ document.getElementById('final-player-top').textContent = `${playerTopCombo} (${playerTopPoints} pts)`;
949
+ document.getElementById('final-player-middle').textContent = `${playerMiddleCombo} (${playerMiddlePoints} pts)`;
950
+ document.getElementById('final-player-bottom').textContent = `${playerBottomCombo} (${playerBottomPoints} pts)`;
951
+
952
+ document.getElementById('final-opponent-top').textContent = `${opponentTopCombo} (${opponentTopPoints} pts)`;
953
+ document.getElementById('final-opponent-middle').textContent = `${opponentMiddleCombo} (${opponentMiddlePoints} pts)`;
954
+ document.getElementById('final-opponent-bottom').textContent = `${opponentBottomCombo} (${opponentBottomPoints} pts)`;
955
+
956
+ document.getElementById('final-player-score').textContent = playerScore;
957
+ document.getElementById('final-opponent-score').textContent = opponentScore;
958
+
959
+ document.getElementById('score-summary').classList.remove('hidden');
960
+ document.getElementById('results').classList.add('hidden');
961
+ }
962
+
963
+ // Reset all cards
964
+ function resetAllCards() {
965
+ // Clear all slots
966
+ Object.keys(gameState.slots).forEach(slot => {
967
+ gameState.slots[slot] = null;
968
+ });
969
+
970
+ // Reset card positions
971
+ gameState.cards.forEach(card => {
972
+ gameState.cardPositions[card.id] = 'deck';
973
+ });
974
+
975
+ // Clear all visual slots
976
+ document.querySelectorAll('.slot').forEach(slot => {
977
+ slot.innerHTML = '';
978
+ });
979
+
980
+ // Re-render deck
981
+ renderDeck();
982
+
983
+ // Hide results
984
+ document.getElementById('results').classList.add('hidden');
985
+ document.getElementById('score-summary').classList.add('hidden');
986
+
987
+ // Reset combination labels
988
+ ['player-top', 'player-middle', 'player-bottom',
989
+ 'opponent-top', 'opponent-middle', 'opponent-bottom'].forEach(prefix => {
990
+ document.getElementById(`${prefix}-combination`).textContent = '-';
991
+ document.getElementById(`${prefix}-points`).textContent = '0';
992
+ });
993
+
994
+ // Clear final score display
995
+ ['final-player-top', 'final-player-middle', 'final-player-bottom',
996
+ 'final-opponent-top', 'final-opponent-middle', 'final-opponent-bottom',
997
+ 'final-player-score', 'final-opponent-score'].forEach(id => {
998
+ document.getElementById(id).textContent = '';
999
+ });
1000
+
1001
+ // Disable calculate button
1002
+ document.getElementById('calculate-btn').disabled = true;
1003
+ gameState.lastMoveValid = false;
1004
+ }
1005
+
1006
+ // Initialize the game
1007
+ function initGame() {
1008
+ initializeSlots();
1009
+ gameState.cards = createDeck();
1010
+ renderDeck();
1011
+ setupDropZones();
1012
+
1013
+ // Set up buttons
1014
+ document.getElementById('calculate-btn').addEventListener('click', calculateBestMoves);
1015
+ document.getElementById('reset-btn').addEventListener('click', resetAllCards);
1016
+
1017
+ // Disable calculate button initially
1018
+ document.getElementById('calculate-btn').disabled = true;
1019
+ }
1020
+
1021
+ // Start the game
1022
+ initGame();
1023
+ });
1024
+ </script>
1025
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=trd69/cps" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1026
+ </html>
prompts.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ сейчас считаются только роялти. это неправильно. измени правила подсчета очков в конце раунда (когда у обоих игроков по 13 карт и все ряды заполнены картами) правила: Базовые очки: +1 очко за каждый выигранный ряд. сравнивай комбинацию в верхнем ряду игрока и комбинацией в верхнем ряду оппонента. у кого сильнее, тому 1 балл. и так с каждым рядом Скуп: +3 бонусных очка за победу во всех трех рядах. Роялти: дополнительные очки за собранные комбинации. начисляются дополнительно Разбитие: если игрок нарушает порядок старшинства рядов, он получает 0 очков за раздачу. Обнуляются все очки. даже роялти
2
+ верни обратно
3
+ оптимизируй код, но сохрани весь функционал. обязательно сохрани функционал