How do you code this problem in Java? How do you code the players choosing a card?
PROBLEM 1: Match-making [50points] For the first portion of this problem, you will implement a simple version of our game Ochos Locos. For this simplified version, there will be three players. The rules of the game are as follows: Basic Rules of the game Ochos Locos Setup: The game starts with a shuffled deck of 32 cards (given to you). Each player is dealt 5 cards and one card is uptured in the discard pile. The remaining cards from the deck are placed in a draw pile Play: . On a player's turn, they must play a card (if one exists) that matches either the colour or number of the card played just before: of the player has more cards in their hand of the matching number than they do of the matching colour: . They will choose to play a card of matching number. (e.g. 4) They will play the card of that number that they have which comes first in rainbow order, red-yellow-green-blue. (i.e. R4-Y4-G4-B4) o If the player equal or more cards in their hand of the matching colour than they do of the matching number. . They will choose to play a card of matching colour. They will play the card of that colour that they have which comes first counting order: 1-2-3-4-5-6-7-8. thave a card that they are able to play, they pick up a new card from the top of the draw pile (if one exists, pass if not). Input Hand of player one initially 5 cards) Hand of player two (initially 5 cards) Hand of player three initially 5 cards) First card in the discard pile on which to you play on (1 card) Remaining cards in the draw pile [top to bottom, all remaining cards) Processing 1. Output the starting card on the discard pile. 2. Starting with player one, decide which card they will play (or pick up from the draw pile) and output their choice (or DRAW if they have no match and must try to pick up a card from the draw pile). 3. Repeat this for each player until a player has no more cards in their hand. This player becomes the winner of the game. Output format 0: {First/starting card on the discard pile) 1: {Card played by player 1"} 2: (Card played by player 2*} 3: {Card played by player 3*} 1: {Card played by player 1"} 2: (Card played by player 2"} 3: {Card played by player 3*} {N}: {Last card played by player N} (WINNER) Where N = 1.2 or 3, the player first able to play all of their cards and empty their hand *If no card is able to be played by a player, output DRAN on their turn and pick up a card from the draw pile (if one exists). Sample input Sample output New hand after play Y3 Y7 Y8 B1 B7 R8 Y1 G4 G8 B8 R3 R4 R7 Y6 B5 0: B3 1: B1 2: B8 B3 3: B5 R2 G5 B6 Y5 G3 G2 ... Y4 R1 G1 Y2 G6 ... B4 R5 G7 R6 B2 1: B7 DRAW R7 1: Y3 Y7 Y8 B B7 2: R8 Yi G4 G8 B8 3: R3 R4 R7 Y6 B5 1: Y3 Y7 Y8 B7 2: R2 R8 YI G4 G8 3: R3 R4 R7 Y6 1: Y3 * Y8 2: R2 R8 44 G4 G8 3: R3 R4 86 1: 3 Y8 2: R2 R8 G4 G5 G8 3: R3 R4 1: Y8 2: R2 R8 G4 G5 G8 3: R4 3: Y6 1: Y3 2: DRAW 3: R3 1: DRAW 2: R2 3: R4 (WINNER) PROBLEM 1: Match-making [50points] For the first portion of this problem, you will implement a simple version of our game Ochos Locos. For this simplified version, there will be three players. The rules of the game are as follows: Basic Rules of the game Ochos Locos Setup: The game starts with a shuffled deck of 32 cards (given to you). Each player is dealt 5 cards and one card is uptured in the discard pile. The remaining cards from the deck are placed in a draw pile Play: . On a player's turn, they must play a card (if one exists) that matches either the colour or number of the card played just before: of the player has more cards in their hand of the matching number than they do of the matching colour: . They will choose to play a card of matching number. (e.g. 4) They will play the card of that number that they have which comes first in rainbow order, red-yellow-green-blue. (i.e. R4-Y4-G4-B4) o If the player equal or more cards in their hand of the matching colour than they do of the matching number. . They will choose to play a card of matching colour. They will play the card of that colour that they have which comes first counting order: 1-2-3-4-5-6-7-8. thave a card that they are able to play, they pick up a new card from the top of the draw pile (if one exists, pass if not). Input Hand of player one initially 5 cards) Hand of player two (initially 5 cards) Hand of player three initially 5 cards) First card in the discard pile on which to you play on (1 card) Remaining cards in the draw pile [top to bottom, all remaining cards) Processing 1. Output the starting card on the discard pile. 2. Starting with player one, decide which card they will play (or pick up from the draw pile) and output their choice (or DRAW if they have no match and must try to pick up a card from the draw pile). 3. Repeat this for each player until a player has no more cards in their hand. This player becomes the winner of the game. Output format 0: {First/starting card on the discard pile) 1: {Card played by player 1"} 2: (Card played by player 2*} 3: {Card played by player 3*} 1: {Card played by player 1"} 2: (Card played by player 2"} 3: {Card played by player 3*} {N}: {Last card played by player N} (WINNER) Where N = 1.2 or 3, the player first able to play all of their cards and empty their hand *If no card is able to be played by a player, output DRAN on their turn and pick up a card from the draw pile (if one exists). Sample input Sample output New hand after play Y3 Y7 Y8 B1 B7 R8 Y1 G4 G8 B8 R3 R4 R7 Y6 B5 0: B3 1: B1 2: B8 B3 3: B5 R2 G5 B6 Y5 G3 G2 ... Y4 R1 G1 Y2 G6 ... B4 R5 G7 R6 B2 1: B7 DRAW R7 1: Y3 Y7 Y8 B B7 2: R8 Yi G4 G8 B8 3: R3 R4 R7 Y6 B5 1: Y3 Y7 Y8 B7 2: R2 R8 YI G4 G8 3: R3 R4 R7 Y6 1: Y3 * Y8 2: R2 R8 44 G4 G8 3: R3 R4 86 1: 3 Y8 2: R2 R8 G4 G5 G8 3: R3 R4 1: Y8 2: R2 R8 G4 G5 G8 3: R4 3: Y6 1: Y3 2: DRAW 3: R3 1: DRAW 2: R2 3: R4 (WINNER)