Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

War Card Game

JamesCaron
JamesCaron 


This project is about simulating a card War game which is played by two players. The details of the description and the accompanying 3 pre written classes (codes) are available in the attachments below. Attachments Tags
Clarifications

Answers

Java - War Card Game Solution

dickersonka
dickersonka 



Attached is the solution to... Attachments
War.zip (7 K) Download

Preview
//Get the winner card if(winnerCard > 0){ //Card 1 larger return 1; } else { //Card 2 larger return -1; } } /** * Gets the rank and suit of card as a string */ public String

Preview
card of playing pile * @return Card removed */ public Card removeTopCard(){ return this.pile.remove(0); } /** * Clears all cards in the card pile */ public void clear(){ this.pile.clear(); } /** * Gets list of

Preview
@param args */ public static void main(String[] args){ Deck deck = new Deck(); //Gets cards in non shuffled deck Card[] cards = deck.getAllCards(); System.out.println("Not shuffled"); System.out.println("Bottom of Deck--->"); //Prints deck for(Card card : cards){ System.out.println(card.toString()); } System.out.println("Top of

Preview
long seed){ this.player1 = new Player(player1); this.player2 = new Player(player2); this.seed = seed; dealCards(); } /** * Deals cards */ private void dealCards(){ //Create new deck Deck deck = new Deck(); //Shuffle deck with the seed

Preview
add */ public void wonCards(List<Card> cards){ for(Card card : cards){ this.winCardPile.addCard(card); } } /** * Adds a card to the playing pile * @param card Card to add */ public void addCard(Card card){ this.cardPile.addCard(card); }

Preview
// Get random number generator (RNG) seed and initialize the game System.out.print ("Please enter the RNG seed for shuffling: "); long rngSeed = keybd.nextLong(); Game war = new Game(p1Name, p2Name, rngSeed); int turn = 1; // While game is being played, print details

Preview
symbol, String name) { this.symbol = symbol; this.name = name; } /** * Returns the symbol for the rank (e.g. ACE is 'a'). * * @return the symbol */ public char getSymbol() { return this.symbol; }

Preview
Susan M. Mitchell (Created: 10 Nov 2007) * @author Daniel J. Hood (Modified: 23 Mar 2011) * @author Susan M. Mitchell (Modified: 07 Dec 2012) */ package proj2; public enum Suit { /** * The suit CLUBS */ CLUBS('c', "Clubs"),

screenshot.jpg (20 K) Download Preview

Screenshots
Screenshot
Purchase Answer