Results 1 to 3 of 3

Thread: Need help

  1. #1
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Default Need help

    I have to make the game "War" for my computer science class. We were instructed to use arrays to accomplish this. Once a card from one deck is used, how would I add it to the other persons deck/remove it from mine?

    The name of the deck array is playerDeck.
    To output a card I have been doing:
    System.out.println ("Your card is the " + playerDeck.deck[c]);
    c gets incremented by one each time through the while loop.
    Let's say that I lose, that the opponents card is higher, how would I remove card "c" from the playerDeck array and add it to the opponents deck array, called compDeck?

    I know I am new here, but I appreciate any help in this matter.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Moderators: please close this cross-post.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    rideexpedition, this is a forum not a coda bank, or no one here wants to do your homework. Please show your attempt first. If you stuck on something we can help you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •