1. Create a program to simulate the card game War. You may utilize the War, Card, Deck, and Player classes developed in class. Make sure your deck uses all 54 cards in a standard deck of cards. Use...

1 answer below »

1. Create a program to simulate the card game War. You may utilize the War, Card, Deck, and Player classes developed in class. Make sure your deck uses all 54 cards in a standard deck of cards. Use appropriate data structures. Use appropriate object-oriented programming. Finally, make use of methods (i.e. don’t put everything in the main). Note: Do not prompt the user for ANY input. Assignments submitted with prompts for user input will not be graded.




  1. First, create the game for two players. Print the cards as they are played during the game (including wars) on separate lines. Also, print the winner of the round on a new line. Identify which player won (i.e. Player x has won this round, Player x has won the war, etc.).




  2. Print the number of cards each player has left at each step after the round winner has been declared.




  3. Keep track of the number of rounds in the game and display this information at the end, along with which player won the game. The game must end only when 1 player has all the cards. d. Include screenshots of a normal turn during the game, a basic war, a tied war and the summary of the game.




2. In a separate file, play 1,000 games of two-player war. (It is recommended that you comment out your round by round print statements.) Use Java to find:




  1. The average number of rounds per game.




  2. The average number of wars per game.




  3. The number of wins by each player.




  4. Attach a screenshot of the summary output.




  5. In a separate Word file, comment about the results. Based on what you know about the war game, were the results what you expected? Theorize why or why not.




For Extra point: Expand your War game to include 3 players. Your code must be able to conclude the game with only a single winner and deal with scenarios where multiple players draw the same card again in the war. You must attach a screenshot of a 3 player war code being implemented and clearly identify this section of code in your submission to receive credit. This should be as a separate file.



Answered 2 days AfterMar 18, 2021

Answer To: 1. Create a program to simulate the card game War. You may utilize the War, Card, Deck, and Player...

Vaishnavi R answered on Mar 20 2021
140 Votes
ass6/ass6.docx
Outputs for 1000 games
Conclusions – There will be on an average of 20 wars per game. There will be on an average 1500- 2000 rounds played per game. Total wins by each player will be 600 thousand to 700thousand wins.
as
s6/ass6p1.png
ass6/ass6p2.png
ass6/CardGameWar/.classpath

    
        
            
        
    
    
    
ass6/CardGameWar/.project

     CardGameWar
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
ass6/CardGameWar/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=15
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=15
ass6/CardGameWar/bin/Card.class
ass6/CardGameWar/bin/Deck.class
ass6/CardGameWar/bin/Game3Players.class
ass6/CardGameWar/bin/MultipleGames.class
ass6/CardGameWar/bin/Player.class
ass6/CardGameWar/bin/War.class
ass6/CardGameWar/src/Card.class
public synchronized class Card {
private int value;
private String suit;
public void Card(int, String);
public int getValue();
public String getSuit();
}
ass6/CardGameWar/src/Card.java
ass6/CardGameWar/src/Card.java
public class Card {
    private int value; 
    private String suit;

    public Card(int value, String suit) {
        this.value = value;
        this.suit = suit;
    }

    public int getValue() {
        return value;
    }
    public String getSuit() {
        return suit;
    }
}
ass6/CardGameWar/src/Deck.class
public synchronized class Deck {
private java.util.ArrayList deck;
public void Deck();
public String DisplayDeck();
public void shuffle();
public Card dealcard();
public int...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here