need some help coding java!!

Discussion in 'OT Technology' started by maxgohan, Jun 13, 2005.

  1. maxgohan

    maxgohan OT Supporter

    Joined:
    May 1, 2004
    Messages:
    8,742
    Likes Received:
    2
    Location:
    btown, toronto
    hey guys i have a java class in a senior high school computers class and as our final project we have to code a game...
    im not very good with java as i wasnt introduced to it in my old school before i switched over to my new school...sooo if someone can help me it woudl be GREATLY appreciated :big grin::big grin:

    well my game that i want to code is the card game WAR...you remember the game where the deck is split into halves and each player draws a card...highest card is the winner...if the same number card is drawn then 3 cards are put down and 1 is selected and the higher one takes all 8 cards on the table...you have to get the most cards to win...

    well if anyone can help then i would love you forever because this is worth alot :big grin::big grin:
     
  2. aphoric

    aphoric Even if god did exist, it would be necessary to ab

    Joined:
    Aug 29, 2003
    Messages:
    918
    Likes Received:
    0
    Location:
    Leaving Afghanistan
  3. Corp

    Corp OT Supporter

    Joined:
    Sep 11, 2003
    Messages:
    28,201
    Likes Received:
    0
    Location:
    Providence, RI
    need to ask specific questions before anyone will help you.
     
  4. Up All Night

    Up All Night I might sleep all day

    Joined:
    Jan 23, 2004
    Messages:
    2,104
    Likes Received:
    0
    Thats incredibly simple. Just made an array Deck that holds card objects. Each card should hold return an int value of 2-14. Shuffle the deck, then have for statements to deal cards to the two players (put them in an arraylist) Then just have if statements

    if (player1hand.get(num).getValue() > player2hand.get(num).getValue())
    {
    playerhand.add(playerhand2.get(num))
    player2hand.remove(num)
    }
    and so on
    just put that in a for statement, have num increment each time or something. Then you just need if statements for if the same card is the same
     

Share This Page