-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.js
784 lines (702 loc) · 28.7 KB
/
game.js
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
class Game {
constructor(gameId, playerId, username, boardId) {
this.gameId = gameId;
this.playerId = playerId;
this.username = username;
this.boardId = boardId;
this.board = null;
this.playerColors = {};
this.p1id = null;
this.p2id = null;
this.currentPlayerId = null;
this.currentTurn = null;
let selectedPieceId = null;
this.placedPieces = []; // Array to store placed pieces (e.g., { pieceId: 1, position: { x: 5, y: 5 } })
this.boardSelectedCoordinates = []; // Array to store board selected coordinates (e.g., [ [0, 0], [0, 1], ... ])
}
init() {
console.log(this.boardId, this.gameId, this.playerId, this.username);
console.log("Game initialized.");
this.loadBoard(); // Fetch initial board data from server
}
reLoadBoard() {
$.ajax({
url: 'board_transactions.php',
type: 'POST',
data: {
action: 'load',
gameId: this.gameId,
boardId: this.boardId
},
success: (response) => {
response = JSON.parse(response);
if (response.status === 'success') {
console.log("Board loaded:", response.board);
this.board = response.board; // Store the game board
this.renderBoard(); // Render the game board after loading
} else {
console.error("Error loading board:", response.message);
// Handle the error
}
},
error: () => {
console.error("Error loading board from server.");
// Handle the error
}
});
}
loadBoard() {
$.ajax({
url: 'board_transactions.php',
type: 'POST',
data: {
action: 'load',
gameId: this.gameId,
boardId: this.boardId
},
success: (response) => {
response = JSON.parse(response);
if (response.status === 'success') {
console.log("Board loaded:", response.board);
this.board = response.board; // Store the game board
this.loadPlayerColors(); // Fetch player colors from database
this.renderBoard(); // Render the game board after loading
} else {
console.error("Error loading board:", response.message);
// Handle the error
}
},
error: () => {
console.error("Error loading board from server.");
// Handle the error
}
});
}
loadPlayerColors() {
$.ajax({
url: 'board_transactions.php',
type: 'POST',
data: {
action: 'loadPlayerColors',
gameId: this.gameId
},
success: (response) => {
response = JSON.parse(response);
if (response.status === 'success') {
this.p1id = response.player1_id;
this.p2id = response.player2_id;
this.playerColors = {
[this.p1id]: [response.player1_color, response.player3_color],
[this.p2id]: [response.player2_color, response.player4_color]
};
this.currentPlayerId = this.p1id; // Assuming player 1 starts
this.currentTurn = 1; // Assuming player 1 starts
this.renderStats();
console.log("Player colors loaded - P1: ", this.playerColors[this.p1id], "P2: ", this.playerColors[this.p2id]);
} else {
console.error("Error loading player colors:", response.message);
// Handle the error (e.g., display a message to the user)
}
},
error: () => {
console.error("Error loading player colors from server.");
// Handle the error
}
});
}
renderBoard() {
const boardContainer = document.getElementById('gameBoard');
boardContainer.innerHTML = ''; // Clear existing content
const table = document.createElement('table');
for (let row of this.board) {
const tableRow = document.createElement('tr');
for (let cell of row) {
const tableCell = document.createElement('td');
tableCell.classList.add('board-cell');
const playerColor = cell; // Cell value represents player Color
switch (playerColor) {
case 'b':
tableCell.style.backgroundColor = 'blue';
break;
case 'r':
tableCell.style.backgroundColor = 'red';
break;
case 'g':
tableCell.style.backgroundColor = 'green';
break;
case 'y':
tableCell.style.backgroundColor = 'yellow';
break;
default:
tableCell.style.backgroundColor = 'white'; // Default color for empty cells
}
tableRow.appendChild(tableCell);
}
table.appendChild(tableRow);
}
boardContainer.appendChild(table);
}
renderStats() {
const statsContainer = document.getElementById('gameStatus');
const playerColorsContainer = document.getElementById('gamePlayers');
statsContainer.innerHTML = ''; // Clear existing content
playerColorsContainer.innerHTML = ''; // Clear existing content
// console.log("Current Player: ", this.currentPlayerId, "Current Color: ", this.currentTurn);
let currentPlayer;
let currentRole;
let currentPID;
let currentColor;
let currentColorNum;
if (this.currentPlayerId === this.p1id) {
currentPlayer = 0;
currentRole = 'Player 1';
currentPID = this.p1id;
} else if (this.currentPlayerId === this.p2id) {
currentPlayer = 1;
currentRole = 'Player 2';
currentPID = this.p2id;
}
if (this.currentTurn === 1) {
currentColor = this.playerColors[this.currentPlayerId][0];
} else {
currentColor = this.playerColors[this.currentPlayerId][1];
}
// Get color name from code
const colorNames = {
b: 'Blue',
r: 'Red',
g: 'Green',
y: 'Yellow'
};
statsContainer.innerHTML = `
<h3>Current Player: ${currentPID} (${currentRole}) </h3>
<p>Current Color: ${colorNames[currentColor] || 'Unknown'}</p>
`;
playerColorsContainer.innerHTML = `
<h3>Player 1 Colors: </h3> <span> ${colorNames[this.playerColors[this.p1id][0]] || 'Unknown'} and ${colorNames[this.playerColors[this.p1id][1]] || 'Unknown'}</span>
<h3>Player 2 Colors: </h3> <span> ${colorNames[this.playerColors[this.p2id][0]] || 'Unknown'} and ${colorNames[this.playerColors[this.p2id][1]] || 'Unknown'}</span>
`;
}
addPiece(coordinates, pieceId, playerId, gameId, boardId) {
let currentColor = null;
// Validate player ID and current player
if (playerId != this.currentPlayerId) {
console.error("It's not your turn!");
return;
}
// Validate Available piece ID
let validPiece = this.isValidPieceId(pieceId, playerId, gameId);
if (validPiece === false) { // Check for strict equality to false
console.error("Invalid piece ID.");
return;
}
// Validate coordinates
if (!this.isValidCoordinates(coordinates, boardId, gameId, pieceId)) {
console.error("Invalid coordinates.");
return;
}
console.log('currentTurn: ', this.currentTurn == 1);
if (this.currentTurn === 1){
currentColor = this.playerColors[playerId][0];
console.log('currentColor: ', currentColor);
} else if (this.currentTurn === 2){
currentColor = this.playerColors[playerId][1];
console.log('currentColor: ', currentColor);
}
// // Check if the piece can be placed on the board according to the "One Color per Side" rule
// if (!this.isValidPlacement(pieceId, position)) {
// console.error("Invalid placement. Please follow the color and side rules.");
// return;
// }
// Update the board
// const pieceCoordinates = this.getPieceCoordinates(pieceId);
// this.getPieceCoordinates(pieceId)
// .then(pieceCoordinates => {
// console.log(pieceCoordinates);
// for (const coordinate of pieceCoordinates) {
// const x = coordinate[0];
// const y = coordinate[1];
// const currentPlayerColors = this.playerColors[this.currentPlayerId];
// if (this.currentTurn === 1) {
// const currentColor = currentPlayerColors[0];
// this.board[y][x] = currentColor;
// } else if (this.currentTurn === 2) {
// const currentColor = currentPlayerColors[1];
// this.board[y][x] = currentColor;
// }
// }
// })
// .catch(error => {
// console.error("Error fetching piece coordinates:", error);
// // Handle the error here (e.g., display an error message to the user)
// return; // Exit the addPiece() function if there's an error
// });
// Update the board on the server
this.updateBoardOnServer(gameId, boardId, coordinates, pieceId, playerId, currentColor);
// Fetch and update placed pieces from the database
this.fetchAndRenderPlacedPieces();
// // Advance to the next turn
this.nextPlayer();
// Render the updated board
this.renderBoard();
return true;
}
nextPlayer() {
if (this.currentTurn === 1) {
this.currentTurn = 2;
} else if (this.currentTurn === 2) {
if (this.currentPlayerId === this.p1id) {
this.currentPlayerId = this.p2id;
this.currentTurn = 1;
} else {
this.currentPlayerId = this.p1id;
this.currentTurn = 1;
}
}
}
updateBoardOnServer(gameId, boardId, coordinates, pieceId, playerId, currentColor) {
$.ajax({
url: 'board_transactions.php',
type: 'POST',
data: {
action: 'update',
gameId: gameId,
boardId: boardId,
coordinates: coordinates,
pieceId: pieceId,
playerId: playerId,
currentColor: currentColor
},
success: (response) => {
response = JSON.parse(response);
console.log("updateBoardOnServer", response);
if (response.status === 'success') {
console.log("Board updated on server");
} else {
console.error("Error updating board on server:", response.message);
}
},
error: () => {
console.error("Error updating board on server.");
}
});
}
fetchAndRenderPlacedPieces() {
$.ajax({
url: 'board_transactions.php',
type: 'POST',
data: {
action: 'getPlacedPieces',
gameId: this.gameId
},
dataType: 'json',
success: (response) => {
if (response.status === 'success') {
this.placedPieces = response.placedPieces; // Update placedPieces array with data from server
this.renderBoard(); // Re-render the board to reflect the updated pieces
} else {
console.error("Error fetching placed pieces:", response.message);
}
},
error: () => {
console.error("Error fetching placed pieces.");
}
});
}
// isValidPlacement(pieceId, position) {
// const pieceCoordinates = this.getPieceCoordinates(pieceId);
// const playerColor = this.playerColors[this.currentPlayerId][this.currentTurn - 1];
// // 1. Check for first piece placement
// if (!this.isFirstPiecePlacementValid(pieceCoordinates, position)) {
// return false;
// }
// // 2. Check for corner adjacency with existing pieces
// if (!this.hasCornerAdjacency(pieceCoordinates, position)) {
// return false;
// }
// // 3. Check for no side contact with own color pieces
// if (this.hasSideContactWithOwnColor(pieceCoordinates, position, playerColor)) {
// return false;
// }
// return true;
// }
// isFirstPiecePlacementValid(playerId, pieceCoordinates, position) {
// const x = position.x;
// const y = position.y;
// const playerColor = this.playerColors[this.currentPlayerId][this.currentTurn - 1];
// // Check if any pieces have been placed
// if (this.placedPieces.length === 0) {
// // Handle first piece placement for each player
// if (this.currentPlayerId === this.p1id) {
// if (playerColor === this.playerColors[0][0]) { // Player 1, first color
// return (x === 0 && y === 0); // Top-left corner
// } else { // Player 1, second color
// return (x === this.board[0].length - 1 && y === this.board.length - 1); // Bottom-right corner
// }
// } else if (this.currentPlayerId === this.p2id) {
// if (playerColor === this.playerColors[1][0]) { // Player 2, first color
// return (x === this.board[0].length - 1 && y === 0); // Top-right corner
// } else { // Player 2, second color
// return (x === 0 && y === this.board.length - 1); // Bottom-left corner
// }
// }
// } else {
// // Check if the other player has already placed their first piece
// const otherPlayerId = this.currentPlayerId === this.p1id ? 1 : 0;
// const otherPlayerFirstColor = this.playerColors[otherPlayerId][0];
// if (this.hasPiecesWithColor(otherPlayerFirstColor)) {
// // If the other player has placed their first piece, no restrictions for the current player
// return true;
// } else {
// // If the other player hasn't placed their first piece,
// // the current player must also place their first piece in the correct corner
// if (this.currentPlayerId === this.p1id) {
// if (playerColor === this.playerColors[0][0]) { // Player 1, first color
// return (x === 0 && y === 0); // Top-left corner
// } else { // Player 1, second color
// return (x === this.board[0].length - 1 && y === this.board.length - 1); // Bottom-right corner
// }
// } else if (this.currentPlayerId === this.p2id) {
// if (playerColor === this.playerColors[1][0]) { // Player 2, first color
// return (x === this.board[0].length - 1 && y === 0); // Top-right corner
// } else { // Player 2, second color
// return (x === 0 && y === this.board.length - 1); // Bottom-left corner
// }
// }
// }
// }
// return false;
// }
hasPiecesWithColor(color) {
for (let row of this.board) {
for (let cell of row) {
if (cell === color) {
return true;
}
}
}
return false;
}
loadAvailablePieces() {
const gameId = $('#global_gameid').val(); // Get gameId from the hidden input
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'loadPieces',
gameId: gameId
},
dataType: 'json',
success: function(data) {
const p1color1 = document.getElementById(`p1color1`);
const p1color2 = document.getElementById(`p1color2`);
const p2color1 = document.getElementById(`p2color1`);
const p2color2 = document.getElementById(`p2color2`);
p1color1.innerHTML = '<h4>Color 1</h4>';
p1color2.innerHTML = '<h4>Color 2</h4>';
p2color1.innerHTML = '<h4>Color 1</h4>';
p2color2.innerHTML = '<h4>Color 2</h4>';
let playerContainer = null;
let pieceHeaders = null;
data.pieces.forEach(piece => {
if (piece.player_num === 'p1') {
playerContainer = p1color1;
pieceHeaders = "Player 1 Color 1 Pieces";
} else if (piece.player_num === 'p2') {
playerContainer = p2color1;
pieceHeaders = "Player 2 Color 1 Pieces";
} else if (piece.player_num === 'p3') {
playerContainer = p1color2;
pieceHeaders = "Player 1 Color 2 Pieces";
} else if (piece.player_num === 'p4') {
playerContainer = p2color2;
pieceHeaders = "Player 2 Color 2 Pieces";
} else {
console.error('Invalid player number:', piece.player_num);
return;
}
const pieceElement = document.createElement('p');
pieceElement.classList.add('piece');
pieceElement.innerHTML = piece.available_piece_id + " - " + piece.piece_name;
playerContainer.appendChild(pieceElement);
});
},
error: function(xhr, status, error) {
console.error('Error loading pieces:', error);
}
});
}
isValidPieceId(pieceId, playerId, gameId) {
return new Promise((resolve, reject) => {
let colorNum = '';
let pieceValidBool = false;
if(this.currentPlayerId == this.p1id) {
// console.log('A');
if(this.currentTurn == 1) {
// console.log('A1');
colorNum = 'p1';
} else {
// console.log('A2');
colorNum = 'p3';
}
} else {
// console.log('B');
if(this.currentTurn == 1) {
// console.log('B1');
colorNum = 'p2';
} else {
// console.log('B2');
colorNum = 'p4';
}
}
// console.log("Piece ID: ", pieceId, "Player ID: ", playerId, "Game ID: ", gameId, "Color Num: ", colorNum);
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'pieceValidation',
gameId: gameId,
playerId: playerId,
colorNum: colorNum
},
dataType: 'json',
success: function(data) {
data.pieces.forEach(piece => {
if (piece.available_piece_id == pieceId) {
pieceValidBool = true;
}
});
if (pieceValidBool) {
console.log("Piece is valid");
resolve(true);
} else {
alert("Piece is invalid");
reject(false);
}
},
error: function(error) {
alert('Error loading pieces:', error.message);
reject(false);
}
});
});
}
isValidCoordinates(coordinates, boardId, gameId, pieceId) {
return new Promise((resolve, reject) => {
console.log('TEST', JSON.stringify(coordinates), boardId, gameId, pieceId);
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'validateCoordinates',
gameId: gameId,
boardId: boardId,
coordinates: JSON.stringify(coordinates), // Send coordinates as JSON string
pieceId: pieceId
},
dataType: 'json',
success: function(data) {
if (data.status === 'success') {
resolve(true); // Coordinates are valid
} else {
console.error(data.message);
alert("Coordinates are invalid");
reject(false);
}
},
error: function(xhr, status, error) {
console.log(error);
console.error('Error validating coordinates:', error);
reject(error);
}
});
});
}
getPieceCoordinates(pieceId) {
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'getPieceCoordinates',
pieceId: pieceId
},
dataType: 'json',
success: function(data) {
if (data.status === 'success') {
resolve(data.pieceCoordinates); // Return the array of coordinates
} else {
console.error('Error fetching piece coordinates:', data.message);
reject(data.message);
}
},
error: function(xhr, status, error) {
console.error('Error validating coordinates:', error);
reject(error);
}
});
});
}
hasAvailableMoves(gameId, playerId) {
// Check if the current player has any available moves
// (i.e., if there are any available pieces that can be placed on the board)
// Return true if the player has available moves, and false otherwise
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'hasAvailableMoves',
gameId: gameId,
playerId: playerId
},
dataType: 'json',
success: function(data) {
if (data.status === 'success') {
return true; // Player has available moves
} else {
return false; // Player has no available moves
}
},
error: function(xhr, status, error) {
console.error('Error validating coordinates:', error);
}
});
}
endingState(gameId, winner) {
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: 'end_game_functions.php',
data: {
action: 'endingState',
gameId: gameId,
winner: winner
},
dataType: 'json',
success: function(data) {
if (data.status === 'success') {
resolve(true); // Ending state updated
} else {
reject(false); // Ending state not updated
}
},
error: function(xhr, status, error) {
console.error('Error updating ending state:', error);
reject(false);
}
});
});
}
calculateAndDisplayScores(gameId) {
$.ajax({
type: 'POST',
url: 'board_transactions.php',
data: {
action: 'calculateScores',
gameId: gameId
},
dataType: 'json',
success: (data) => {
if (data.status === 'success') {
const playerScores = data.playerScores;
// Initialize an array to store total scores for each player
const userTotals = [0, 0]; // Assuming two players
let possibleWinnerID = [0, 0];
// Calculate total score for each player
playerScores.forEach(playerScore => {
if (playerScore.player_num === 'p1' || playerScore.player_num === 'p3') {
userTotals[0] += playerScore.score; // Add score to player 1's total
possibleWinnerID[0] = playerScore.player_id;
} else if (playerScore.player_num === 'p2' || playerScore.player_num === 'p4') {
userTotals[1] += playerScore.score; // Add score to player 2's total
possibleWinnerID[1] = playerScore.player_id;
}
});
let winningPlayerID = 0;
// Determine the winner (player with the highest score)
let winningPlayer = 0; // Assume draw initially
if (userTotals[1] > userTotals[0]) {
winningPlayerID = possibleWinnerID[1];
winningPlayer = 2;
} else if (userTotals[1] < userTotals[0]) {
winningPlayerID = possibleWinnerID[0];
winningPlayer = 1;
}
const player1ScoresElement = document.getElementById('player1Scores');
const player2ScoresElement = document.getElementById('player2Scores');
const winnerMessageElement = document.getElementById('winnerMessage');
const winnerIDElement = document.getElementById('winnerID');
player1ScoresElement.innerHTML = `Player 1 Score: ${userTotals[0]}`;
player2ScoresElement.innerHTML = `Player 2 Score: ${userTotals[1]}`;
if (winningPlayer == 1) {
winnerMessageElement.innerHTML = "Player 1 Wins!";
} else if (winningPlayer == 2) {
winnerMessageElement.innerHTML = "Player 2 Wins!";
} else {
winnerMessageElement.innerHTML = "It's a Draw!";
}
if (winningPlayerID == 0) {
winnerIDElement.innerHTML = null;
} else {
winnerIDElement.innerHTML = winningPlayerID;
}
} else {
console.error("Error calculating scores:", data.message);
}
},
error: () => {
console.error("Error calculating scores.");
}
});
}
returnEnd(gameId) {
// if (confirm("Are you sure you want to return to the lobby? You will lose the current game.")) {
$.ajax({
type: 'POST',
url: 'end_game_functions.php',
data: {
action: 'returnEnd',
gameId: gameId
},
// dataType: 'json',
success: function(data) {
console.log(data);
if (data.status == 'success') {
console.log('Game ended successfully.');
window.location.href = 'lobby.php';
} else {
console.error('Error ending the game:', data.message);
// Handle error, e.g., display an error message to the user
}
},
error: function(jqXHR, textStatus, error) {
console.error('Error ending the game:', error); // Use errorThrown instead of 'error'
// Handle error, e.g., display an error message to the user
}
});
}
// }
// $.ajax({
// url: 'board_transactions.php',
// type: 'POST',
// data: {
// action: 'loadPieces',
// gameId: this.gameId,
// playerNum: this.playerNum,
// playerId: this.playerId
// },
// success: function(data) {
// const playerPiecesContainer = document.getElementById(`player${playerId}Pieces`);
// playerPiecesContainer.innerHTML = '';
// data.forEach(piece => {
// const pieceElement = document.createElement('div');
// pieceElement.classList.add('piece');
// pieceElement.innerHTML = piece.piece_name;
// playerPiecesContainer.appendChild(pieceElement);
// });
// },
// error: function(xhr, status, error) {
// console.error('Error loading pieces:', error);
// }
// });
}