Only the value of the card counts (7 <8 <9 <10 <Jack <Queen <King <Ace), the color (clubs, spades, hearts, diamonds) is not relevant. The deck of cards is shuffled and the cards are distributed alternately to the players. Each player now has her own pile face down in front of her.
    In each round, both players take the top card and place it face up in front of them. If the value of the card is the same, both players take the next card from their own face down pile, turn it over and place it on their face up pile. This is repeated until the two cards face up have a different value. (This is usually the case with the first pair of cards.) Then the player who had the card with the higher value takes the other player’s face-up pile, places it on top of her face-up pile, turns the pack over and shoves it under her face-down pile, see Figure 1. Then the next round begins.
    As soon as one player has no cards face down during the draw or at the end of a round, the other player is the winner of the game. If both players have no cards face down during the draw (unlikely case), the game ends indecisively.
    This programming task is about simulating the gameplay round by round. First consider the class Card, which can represent a playing card of the Skat game. The class implements the Comparable interface.
    This programming task is about simulating the gameplay round by round. First consider the class Card, which can represent a playing card of the Skat game. The class implements the Comparable interface. For two objects card1 and card2 of type Card, “card1.compareTo (card2)”
    a negative number if the card card1 has a lower value than the card card2, a positive number if it has a higher value and 0 if the cards have the same value, i.e. only in color (clubs, spades , Heart, diamonds).
    A card is created by calling the constructor “public card (int id)” with an input argument id between 0 and 31. The specific assignment of id to card is not relevant to the task, but can be output by executing Card’s main () method if you are interested.
    The gameplay is simulated in the class Bettelmann. The structure deque (double-ended queue) is used for the hidden card stack closedPile1 and closedPile2 (in contrast to the term card stack). This data structure can be used both as a stack (e.g. with the methods addLast () and pollLast ()) and as a queue (e.g. with the methods addLast () and pollFirst ()). The reason for using Deque is that both functionalities are required here. When the cards are distributed, the cards are placed on the face down piles. The last cards dealt are drawn first (last-in first-out). The cards won in a round will be pushed under the stack and new cards will be removed from above, i.e. first-in first-out.
    The description of the individual methods can be found in the following API and the Javadoc comments in the class. Note that the term deck of cards has no relation to the data structure called stack.

    4.1
    Inspect the distributeCards (Stack <Card> deck) method
    The method distributes the cards handed over to the players’ face-down piles. The cards are taken from the stack one by one and alternately placed face down, so that the last cards dealt are drawn first. The method should first empty the hidden stacks. It should also work for any input, even if deck only contains part of an entire deck of cards.

    4.2 Methode playRound() implementieren
    Here you should realize a round (see above under game rules). Think about which data structure best suits the stack or queue for the open deck of cards that are formed (and collected at the end) during a round. You can also use Deque with the appropriate methods, but one of the structures stack or queue is also sufficient.

    At suitable moments in a round (such as before pulling), make sure that there is something on the different stacks. Even if a tie is considered unlikely, as explained above, you should of course consider the case in your implementation. The method must also set the object variable winner when the game ends on a round. This is the case if at least one of the face-down piles is empty during the draw in a round or at the end of a round.
    Hints:
    There are initial positions that lead to infinite game sequences. Such cases are not tested in the tests. So you don’t need to be considered.

                                                                                                                                      Order Now