diff --git a/Poker Game Extension/icon.png b/Poker Game Extension/icon.png new file mode 100644 index 00000000..a1d3b470 Binary files /dev/null and b/Poker Game Extension/icon.png differ diff --git a/Poker Game Extension/index.html b/Poker Game Extension/index.html new file mode 100644 index 00000000..ac2c5704 --- /dev/null +++ b/Poker Game Extension/index.html @@ -0,0 +1,27 @@ + + + + + + Simple Poker Game + + + +
+
+

Player 1

+
+
+
+

Player 2

+
+
+
+

Community Cards

+
+
+ +
+ + + \ No newline at end of file diff --git a/Poker Game Extension/manifest.json b/Poker Game Extension/manifest.json new file mode 100644 index 00000000..4848e626 --- /dev/null +++ b/Poker Game Extension/manifest.json @@ -0,0 +1,15 @@ +{ + "manifest_version": 3, + "name": "Simple Poker Game", + "version": "1.0", + "description": "A simple poker game extension that combines strategy, skill, and luck.", + "action": { + "default_popup": "index.html", + "default_icon": { + "16": "icon.png", + "48": "icon.png", + "128": "icon.png" + } + }, + "permissions": [] + } \ No newline at end of file diff --git a/Poker Game Extension/script.js b/Poker Game Extension/script.js new file mode 100644 index 00000000..71113380 --- /dev/null +++ b/Poker Game Extension/script.js @@ -0,0 +1,47 @@ +document.getElementById('deal-button').addEventListener('click', dealCards); + +function createDeck() { + const suits = ['♠', '♥', '♦', '♣']; + const ranks = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']; + let deck = []; + for (let suit of suits) { + for (let rank of ranks) { + deck.push(rank + suit); + } + } + return deck; +} + +function shuffleDeck(deck) { + for (let i = deck.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [deck[i], deck[j]] = [deck[j], deck[i]]; + } + return deck; +} + +function dealCards() { + const deck = shuffleDeck(createDeck()); + const player1Hand = deck.slice(0, 2); + const player2Hand = deck.slice(2, 4); + const communityCards = deck.slice(4, 9); + + renderCards('player1-hand', player1Hand); + renderCards('player2-hand', player2Hand); + + document.getElementById('community-cards').innerHTML = ''; + setTimeout(() => renderCards('community-cards', communityCards.slice(0, 3)), 1000); + setTimeout(() => renderCards('community-cards', communityCards.slice(0, 4)), 2000); + setTimeout(() => renderCards('community-cards', communityCards.slice(0, 5)), 3000); +} + +function renderCards(elementId, cards) { + const handElement = document.getElementById(elementId); + handElement.innerHTML = ''; + for (let card of cards) { + const cardElement = document.createElement('div'); + cardElement.className = 'card'; + cardElement.innerText = card; + handElement.appendChild(cardElement); + } +} \ No newline at end of file diff --git a/Poker Game Extension/styles.css b/Poker Game Extension/styles.css new file mode 100644 index 00000000..a547ae85 --- /dev/null +++ b/Poker Game Extension/styles.css @@ -0,0 +1,38 @@ +body { + font-family: Arial, sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #2d2d2d; + color: #ffffff; + margin: 0; +} + +.game-container { + text-align: center; +} + +.player, .community { + margin-bottom: 20px; +} + +.hand { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.card { + width: 60px; + height: 90px; + background-color: #ffffff; + color: #000000; + border: 1px solid #000000; + border-radius: 5px; + display: flex; + justify-content: center; + align-items: center; + margin: 0 5px; + font-size: 20px; +} \ No newline at end of file