// This card game is a variation of the War card game described // in the book "Object-Oriented Data Structures Using Java" by // N.Dale, D.T.Joyce and C.Weems. import java.util.*; public class StrangeCardGame { public static void main (String[] argv) { // Use cards numbered 0,..,9 and deal 5 cards to each player. playGame (5, 10); } static void playGame (int dealSize, int numCards) { // Cards dealt out to player 1: LinkedList player1 = new LinkedList(); // Cards dealt out to player 2: LinkedList player2 = new LinkedList(); // The pile between the two players: LinkedList pile = new LinkedList(); // Make the cards and shuffle them randomly. int[] cards = new int [numCards]; for (int i=0; i player1 gets pile"); } else if (player2first > player1first+2) { // Add pile into player 2's cards. addListToList (pile, player2); System.out.println (" => player2 gets pile"); } else { System.out.println (" => both cards added to pile"); } if (player1.isEmpty()) { System.out.println ("Player 2 wins!"); done = true; } else if (player2.isEmpty()) { System.out.println ("Player 1 wins!"); done = true; } } //end-while } static void shuffle (int[] A) { for (int i=0; i list1, LinkedList list2) { // INSERT YOUR CODE HERE. // This method should extract every item in list1 and add them to list2. } }