diff --git a/client/src/assets/card-back.png b/client/src/assets/card-back.png new file mode 100644 index 0000000..097ded9 Binary files /dev/null and b/client/src/assets/card-back.png differ diff --git a/client/src/assets/cards-front/0B.png b/client/src/assets/cards-front/0B.png new file mode 100644 index 0000000..5ca8690 Binary files /dev/null and b/client/src/assets/cards-front/0B.png differ diff --git a/client/src/assets/cards-front/0G.png b/client/src/assets/cards-front/0G.png new file mode 100644 index 0000000..208c035 Binary files /dev/null and b/client/src/assets/cards-front/0G.png differ diff --git a/client/src/assets/cards-front/0R.png b/client/src/assets/cards-front/0R.png new file mode 100644 index 0000000..249a121 Binary files /dev/null and b/client/src/assets/cards-front/0R.png differ diff --git a/client/src/assets/cards-front/0Y.png b/client/src/assets/cards-front/0Y.png new file mode 100644 index 0000000..5a070c8 Binary files /dev/null and b/client/src/assets/cards-front/0Y.png differ diff --git a/client/src/assets/cards-front/1B.png b/client/src/assets/cards-front/1B.png new file mode 100644 index 0000000..9a3c1ad Binary files /dev/null and b/client/src/assets/cards-front/1B.png differ diff --git a/client/src/assets/cards-front/1G.png b/client/src/assets/cards-front/1G.png new file mode 100644 index 0000000..cc85cef Binary files /dev/null and b/client/src/assets/cards-front/1G.png differ diff --git a/client/src/assets/cards-front/1R.png b/client/src/assets/cards-front/1R.png new file mode 100644 index 0000000..933a170 Binary files /dev/null and b/client/src/assets/cards-front/1R.png differ diff --git a/client/src/assets/cards-front/1Y.png b/client/src/assets/cards-front/1Y.png new file mode 100644 index 0000000..fb58114 Binary files /dev/null and b/client/src/assets/cards-front/1Y.png differ diff --git a/client/src/assets/cards-front/2B.png b/client/src/assets/cards-front/2B.png new file mode 100644 index 0000000..5d12ca1 Binary files /dev/null and b/client/src/assets/cards-front/2B.png differ diff --git a/client/src/assets/cards-front/2G.png b/client/src/assets/cards-front/2G.png new file mode 100644 index 0000000..3cf546c Binary files /dev/null and b/client/src/assets/cards-front/2G.png differ diff --git a/client/src/assets/cards-front/2R.png b/client/src/assets/cards-front/2R.png new file mode 100644 index 0000000..9916701 Binary files /dev/null and b/client/src/assets/cards-front/2R.png differ diff --git a/client/src/assets/cards-front/2Y.png b/client/src/assets/cards-front/2Y.png new file mode 100644 index 0000000..17a1cea Binary files /dev/null and b/client/src/assets/cards-front/2Y.png differ diff --git a/client/src/assets/cards-front/3B.png b/client/src/assets/cards-front/3B.png new file mode 100644 index 0000000..cfd0e42 Binary files /dev/null and b/client/src/assets/cards-front/3B.png differ diff --git a/client/src/assets/cards-front/3G.png b/client/src/assets/cards-front/3G.png new file mode 100644 index 0000000..2df7f6d Binary files /dev/null and b/client/src/assets/cards-front/3G.png differ diff --git a/client/src/assets/cards-front/3R.png b/client/src/assets/cards-front/3R.png new file mode 100644 index 0000000..e1e41c0 Binary files /dev/null and b/client/src/assets/cards-front/3R.png differ diff --git a/client/src/assets/cards-front/3Y.png b/client/src/assets/cards-front/3Y.png new file mode 100644 index 0000000..16fc650 Binary files /dev/null and b/client/src/assets/cards-front/3Y.png differ diff --git a/client/src/assets/cards-front/4B.png b/client/src/assets/cards-front/4B.png new file mode 100644 index 0000000..481878c Binary files /dev/null and b/client/src/assets/cards-front/4B.png differ diff --git a/client/src/assets/cards-front/4G.png b/client/src/assets/cards-front/4G.png new file mode 100644 index 0000000..f7e82d2 Binary files /dev/null and b/client/src/assets/cards-front/4G.png differ diff --git a/client/src/assets/cards-front/4R.png b/client/src/assets/cards-front/4R.png new file mode 100644 index 0000000..4cc9b9a Binary files /dev/null and b/client/src/assets/cards-front/4R.png differ diff --git a/client/src/assets/cards-front/4Y.png b/client/src/assets/cards-front/4Y.png new file mode 100644 index 0000000..ff6c203 Binary files /dev/null and b/client/src/assets/cards-front/4Y.png differ diff --git a/client/src/assets/cards-front/5B.png b/client/src/assets/cards-front/5B.png new file mode 100644 index 0000000..7e0b49f Binary files /dev/null and b/client/src/assets/cards-front/5B.png differ diff --git a/client/src/assets/cards-front/5G.png b/client/src/assets/cards-front/5G.png new file mode 100644 index 0000000..8fd74ab Binary files /dev/null and b/client/src/assets/cards-front/5G.png differ diff --git a/client/src/assets/cards-front/5R.png b/client/src/assets/cards-front/5R.png new file mode 100644 index 0000000..641cbd4 Binary files /dev/null and b/client/src/assets/cards-front/5R.png differ diff --git a/client/src/assets/cards-front/5Y.png b/client/src/assets/cards-front/5Y.png new file mode 100644 index 0000000..cf891c0 Binary files /dev/null and b/client/src/assets/cards-front/5Y.png differ diff --git a/client/src/assets/cards-front/6B.png b/client/src/assets/cards-front/6B.png new file mode 100644 index 0000000..db27c63 Binary files /dev/null and b/client/src/assets/cards-front/6B.png differ diff --git a/client/src/assets/cards-front/6G.png b/client/src/assets/cards-front/6G.png new file mode 100644 index 0000000..731b083 Binary files /dev/null and b/client/src/assets/cards-front/6G.png differ diff --git a/client/src/assets/cards-front/6R.png b/client/src/assets/cards-front/6R.png new file mode 100644 index 0000000..747f9ea Binary files /dev/null and b/client/src/assets/cards-front/6R.png differ diff --git a/client/src/assets/cards-front/6Y.png b/client/src/assets/cards-front/6Y.png new file mode 100644 index 0000000..3e4bd0d Binary files /dev/null and b/client/src/assets/cards-front/6Y.png differ diff --git a/client/src/assets/cards-front/7B.png b/client/src/assets/cards-front/7B.png new file mode 100644 index 0000000..545a6a6 Binary files /dev/null and b/client/src/assets/cards-front/7B.png differ diff --git a/client/src/assets/cards-front/7G.png b/client/src/assets/cards-front/7G.png new file mode 100644 index 0000000..1ad1f61 Binary files /dev/null and b/client/src/assets/cards-front/7G.png differ diff --git a/client/src/assets/cards-front/7R.png b/client/src/assets/cards-front/7R.png new file mode 100644 index 0000000..8834ba5 Binary files /dev/null and b/client/src/assets/cards-front/7R.png differ diff --git a/client/src/assets/cards-front/7Y.png b/client/src/assets/cards-front/7Y.png new file mode 100644 index 0000000..6d35ee5 Binary files /dev/null and b/client/src/assets/cards-front/7Y.png differ diff --git a/client/src/assets/cards-front/8B.png b/client/src/assets/cards-front/8B.png new file mode 100644 index 0000000..55982fd Binary files /dev/null and b/client/src/assets/cards-front/8B.png differ diff --git a/client/src/assets/cards-front/8G.png b/client/src/assets/cards-front/8G.png new file mode 100644 index 0000000..026fa1d Binary files /dev/null and b/client/src/assets/cards-front/8G.png differ diff --git a/client/src/assets/cards-front/8R.png b/client/src/assets/cards-front/8R.png new file mode 100644 index 0000000..2548b9b Binary files /dev/null and b/client/src/assets/cards-front/8R.png differ diff --git a/client/src/assets/cards-front/8Y.png b/client/src/assets/cards-front/8Y.png new file mode 100644 index 0000000..d3f48d0 Binary files /dev/null and b/client/src/assets/cards-front/8Y.png differ diff --git a/client/src/assets/cards-front/9B.png b/client/src/assets/cards-front/9B.png new file mode 100644 index 0000000..0c3fff4 Binary files /dev/null and b/client/src/assets/cards-front/9B.png differ diff --git a/client/src/assets/cards-front/9G.png b/client/src/assets/cards-front/9G.png new file mode 100644 index 0000000..54af4f6 Binary files /dev/null and b/client/src/assets/cards-front/9G.png differ diff --git a/client/src/assets/cards-front/9R.png b/client/src/assets/cards-front/9R.png new file mode 100644 index 0000000..2eeb933 Binary files /dev/null and b/client/src/assets/cards-front/9R.png differ diff --git a/client/src/assets/cards-front/9Y.png b/client/src/assets/cards-front/9Y.png new file mode 100644 index 0000000..aa2c5e3 Binary files /dev/null and b/client/src/assets/cards-front/9Y.png differ diff --git a/client/src/assets/cards-front/D2B.png b/client/src/assets/cards-front/D2B.png new file mode 100644 index 0000000..18e8c0b Binary files /dev/null and b/client/src/assets/cards-front/D2B.png differ diff --git a/client/src/assets/cards-front/D2G.png b/client/src/assets/cards-front/D2G.png new file mode 100644 index 0000000..54d37af Binary files /dev/null and b/client/src/assets/cards-front/D2G.png differ diff --git a/client/src/assets/cards-front/D2R.png b/client/src/assets/cards-front/D2R.png new file mode 100644 index 0000000..00b04f7 Binary files /dev/null and b/client/src/assets/cards-front/D2R.png differ diff --git a/client/src/assets/cards-front/D2Y.png b/client/src/assets/cards-front/D2Y.png new file mode 100644 index 0000000..5fe3fe8 Binary files /dev/null and b/client/src/assets/cards-front/D2Y.png differ diff --git a/client/src/assets/cards-front/D4W.png b/client/src/assets/cards-front/D4W.png new file mode 100644 index 0000000..e2e43ef Binary files /dev/null and b/client/src/assets/cards-front/D4W.png differ diff --git a/client/src/assets/cards-front/W.png b/client/src/assets/cards-front/W.png new file mode 100644 index 0000000..8065dce Binary files /dev/null and b/client/src/assets/cards-front/W.png differ diff --git a/client/src/assets/cards-front/revB.png b/client/src/assets/cards-front/revB.png new file mode 100644 index 0000000..3381f41 Binary files /dev/null and b/client/src/assets/cards-front/revB.png differ diff --git a/client/src/assets/cards-front/revG.png b/client/src/assets/cards-front/revG.png new file mode 100644 index 0000000..0858cdc Binary files /dev/null and b/client/src/assets/cards-front/revG.png differ diff --git a/client/src/assets/cards-front/revR.png b/client/src/assets/cards-front/revR.png new file mode 100644 index 0000000..044a909 Binary files /dev/null and b/client/src/assets/cards-front/revR.png differ diff --git a/client/src/assets/cards-front/revY.png b/client/src/assets/cards-front/revY.png new file mode 100644 index 0000000..7feae17 Binary files /dev/null and b/client/src/assets/cards-front/revY.png differ diff --git a/client/src/assets/cards-front/skipB.png b/client/src/assets/cards-front/skipB.png new file mode 100644 index 0000000..b6f4bbd Binary files /dev/null and b/client/src/assets/cards-front/skipB.png differ diff --git a/client/src/assets/cards-front/skipG.png b/client/src/assets/cards-front/skipG.png new file mode 100644 index 0000000..72f6181 Binary files /dev/null and b/client/src/assets/cards-front/skipG.png differ diff --git a/client/src/assets/cards-front/skipR.png b/client/src/assets/cards-front/skipR.png new file mode 100644 index 0000000..d66f29a Binary files /dev/null and b/client/src/assets/cards-front/skipR.png differ diff --git a/client/src/assets/cards-front/skipY.png b/client/src/assets/cards-front/skipY.png new file mode 100644 index 0000000..c0ea571 Binary files /dev/null and b/client/src/assets/cards-front/skipY.png differ diff --git a/client/src/components/Game.js b/client/src/components/Game.js index b01cc7e..3c2c908 100644 --- a/client/src/components/Game.js +++ b/client/src/components/Game.js @@ -71,10 +71,10 @@ const Game = (props) => { let startingCardIndex while(true) { startingCardIndex = Math.floor(Math.random() * 94) - if(shuffledCards[startingCardIndex]==='skipR' || shuffledCards[startingCardIndex]==='#R' || shuffledCards[startingCardIndex]==='D2R' || - shuffledCards[startingCardIndex]==='skipG' || shuffledCards[startingCardIndex]==='#G' || shuffledCards[startingCardIndex]==='D2G' || - shuffledCards[startingCardIndex]==='skipB' || shuffledCards[startingCardIndex]==='#B' || shuffledCards[startingCardIndex]==='D2B' || - shuffledCards[startingCardIndex]==='skipY' || shuffledCards[startingCardIndex]==='#Y' || shuffledCards[startingCardIndex]==='D2Y' || + if(shuffledCards[startingCardIndex]==='skipR' || shuffledCards[startingCardIndex]==='revR' || shuffledCards[startingCardIndex]==='D2R' || + shuffledCards[startingCardIndex]==='skipG' || shuffledCards[startingCardIndex]==='revG' || shuffledCards[startingCardIndex]==='D2G' || + shuffledCards[startingCardIndex]==='skipB' || shuffledCards[startingCardIndex]==='revB' || shuffledCards[startingCardIndex]==='D2B' || + shuffledCards[startingCardIndex]==='skipY' || shuffledCards[startingCardIndex]==='revY' || shuffledCards[startingCardIndex]==='D2Y' || shuffledCards[startingCardIndex]==='W' || shuffledCards[startingCardIndex]==='D4W') { continue; } @@ -148,7 +148,7 @@ const Game = (props) => { const cardPlayedBy = turn switch(played_card) { //if card played was a number card - case '0R': case '1R': case '2R': case '3R': case '4R': case '5R': case '6R': case '7R': case '8R': case '9R': case '#R': case '0G': case '1G': case '2G': case '3G': case '4G': case '5G': case '6G': case '7G': case '8G': case '9G': case '#G': case '0B': case '1B': case '2B': case '3B': case '4B': case '5B': case '6B': case '7B': case '8B': case '9B': case '#B': case '0Y': case '1Y': case '2Y': case '3Y': case '4Y': case '5Y': case '6Y': case '7Y': case '8Y': case '9Y': case '#Y': { + case '0R': case '1R': case '2R': case '3R': case '4R': case '5R': case '6R': case '7R': case '8R': case '9R': case 'revR': case '0G': case '1G': case '2G': case '3G': case '4G': case '5G': case '6G': case '7G': case '8G': case '9G': case 'revG': case '0B': case '1B': case '2B': case '3B': case '4B': case '5B': case '6B': case '7B': case '8B': case '9B': case 'revB': case '0Y': case '1Y': case '2Y': case '3Y': case '4Y': case '5Y': case '6Y': case '7Y': case '8Y': case '9Y': case 'revY': { //extract number and color of played card const numberOfPlayedCard = played_card.charAt(0) const colorOfPlayedCard = played_card.charAt(1) @@ -701,47 +701,81 @@ const Game = (props) => { return ( (!roomFull) ? <> -

Game Code: {room}

+

Game Code: {room}

- {users.length===2 ? <> + {users.length===2 ? <> - {gameOver ?
{winner !== '' && <>

GAME OVER

{winner} wins!

}Home
: -
-

Turn: {turn}

- {currentUser === 'Player 1' && -
- {player1Deck.map((item) => ( - onCardPlayedHandler(item)} - className='card'> - {item} - - ))} - -
} -
-
-

Current Card: {playedCardsPile[playedCardsPile.length-1]}

-

Current Color: {currentColor}

- -
-
- {currentUser === 'Player 2' && -
- {player2Deck.map((item) => ( - onCardPlayedHandler(item)} - className='card'> - {item} - - ))} - -
} -
- Home -
} + {gameOver ?
{winner !== '' && <>

GAME OVER

{winner} wins!

}Home
: +
+

Turn: {turn}

+ + {currentUser === 'Player 1' && <> +
+ {player1Deck.map((item) => ( + onCardPlayedHandler(item)} + src={require(`../assets/cards-front/${item}.png`).default} + width='100px' + /> + ))} + +
+
+
+ {playedCardsPile && playedCardsPile.length>0 && + } +
+
+
+ {player2Deck.map((item) => ( + onCardPlayedHandler(item)} + src={require(`../assets/card-back.png`).default} + width='100px' + /> + ))} + +
} - :

Waiting for other player

} + {currentUser === 'Player 2' && <> +
+ {player1Deck.map((item) => ( + onCardPlayedHandler(item)} + src={require(`../assets/card-back.png`).default} + width='100px' + /> + ))} + +
+
+
+ {playedCardsPile && playedCardsPile.length>0 && + } +
+
+
+ {player2Deck.map((item) => ( + onCardPlayedHandler(item)} + src={require(`../assets/cards-front/${item}.png`).default} + width='100px' + /> + ))} + +
} + +
+ Home +
} + + :

Waiting for other player

} :

Room full

) diff --git a/client/src/utils/packOfCards.js b/client/src/utils/packOfCards.js index ec3b40c..d9cd6e9 100644 --- a/client/src/utils/packOfCards.js +++ b/client/src/utils/packOfCards.js @@ -1,8 +1,8 @@ -//pack of 108 cards (# = reverse) +//pack of 108 cards export default [ - '0R', '1R', '1R', '2R', '2R', '3R', '3R', '4R', '4R', '5R', '5R', '6R', '6R', '7R', '7R', '8R', '8R', '9R', '9R', 'skipR', 'skipR', '#R', '#R', 'D2R', 'D2R', - '0G', '1G', '1G', '2G', '2G', '3G', '3G', '4G', '4G', '5G', '5G', '6G', '6G', '7G', '7G', '8G', '8G', '9G', '9G', 'skipG', 'skipG', '#G', '#G', 'D2G', 'D2G', - '0B', '1B', '1B', '2B', '2B', '3B', '3B', '4B', '4B', '5B', '5B', '6B', '6B', '7B', '7B', '8B', '8B', '9B', '9B', 'skipB', 'skipB', '#B', '#B', 'D2B', 'D2B', - '0Y', '1Y', '1Y', '2Y', '2Y', '3Y', '3Y', '4Y', '4Y', '5Y', '5Y', '6Y', '6Y', '7Y', '7Y', '8Y', '8Y', '9Y', '9Y', 'skipY', 'skipY', '#Y', '#Y', 'D2Y', 'D2Y', + '0R', '1R', '1R', '2R', '2R', '3R', '3R', '4R', '4R', '5R', '5R', '6R', '6R', '7R', '7R', '8R', '8R', '9R', '9R', 'skipR', 'skipR', 'revR', 'revR', 'D2R', 'D2R', + '0G', '1G', '1G', '2G', '2G', '3G', '3G', '4G', '4G', '5G', '5G', '6G', '6G', '7G', '7G', '8G', '8G', '9G', '9G', 'skipG', 'skipG', 'revG', 'revG', 'D2G', 'D2G', + '0B', '1B', '1B', '2B', '2B', '3B', '3B', '4B', '4B', '5B', '5B', '6B', '6B', '7B', '7B', '8B', '8B', '9B', '9B', 'skipB', 'skipB', 'revB', 'revB', 'D2B', 'D2B', + '0Y', '1Y', '1Y', '2Y', '2Y', '3Y', '3Y', '4Y', '4Y', '5Y', '5Y', '6Y', '6Y', '7Y', '7Y', '8Y', '8Y', '9Y', '9Y', 'skipY', 'skipY', 'revY', 'revY', 'D2Y', 'D2Y', 'W', 'W', 'W', 'W', 'D4W', 'D4W', 'D4W', 'D4W' ] \ No newline at end of file