Results 1 to 6 of 6
  1. #1
    linux1man's Avatar
    linux1man is offline Member
    Join Date
    Nov 2008
    Posts
    39
    Rep Power
    0

    Question Pig Game class plz HELP!!!

    Hi, we are suppose to create a class for the game pig in our Java class having 3 methods: compScore, playerScore, and play. Can somebody please give me an example on what do i need to have in each method. Or show me how to make the class. :confused:

    Thank you,

    P.S.
    // Pig game rules:

    On each turn, the player rolls a pair of ice and adds up his or her points. Whoever reaches 100 points first, wins. if a player rolls 1, he or she looses all points for that round and the dice go to the other player. If a player rolls two 1s in one turn, the player loses all points earned so far in the game and loses control of dice. The player may voluntarily turn over the dice after each roll. So the player must decide to eather roll again (be a pig) and risk loosing points, or give up the dice, possibly letting the other player win. Set up a computer player so that it always gives up the dice after 20 or more points earned.

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

    Default

    Sorry to say, but our track record for helping folks who state they are "completely lost" is poor to dismal as there is only so much a forum can do in this situation. We can't put knowledge in your head; only you can do that. Often the best we can do is to point you to the most basic tutorials online and suggest that you start reading. Also, most in this situation are far better off going to their teacher and asking for some one-on-one face to face help.

    That being said, perhaps we can help you if you have some basic knowledge here, enough to understand what we are suggesting, and perseverance. The first thing you need to do is to try to create this on your own as best you can, then come back with your code and with specific questions (not the "I'm completely lost" kind) that are answerable in the limited format of a Java forum. By posting your code, we can have a better idea of just where you're making bad assumptions or what Java subjects you need to read up on in the tutorials.

    Best of luck!

  3. #3
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default uuhh....

    Let's see if I understand...
    The teacher of your Java class has requested that you create a class that has 3 methods and you don't know how to create a class? I hope I misundertood...
    Anyhow... some suggestions:
    • You have to show some effort... the forum doesn't do homework. Cook up some code, the best you can and when you get stuck, ask your doubts/questions/problems on the forum.
    • Do your program in small chunks... don't try to program everything at once, that only leads to dispear. Do one small part, then another, etc
    • Here are a good link to help you:

    The Java™ Tutorials

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  4. #4
    linux1man's Avatar
    linux1man is offline Member
    Join Date
    Nov 2008
    Posts
    39
    Rep Power
    0

    Default

    I know how to create a class (we just started classes 1 week ago) its just I have trouble understanding what the methods suppose to do (how to use them in order to create a game. For example I know the player, and the computer methods are suppose to roll a pair of dice (which i have created successfully) and keep turns rolling them but I don't know how to make them do that.
    -- Ubuntu 8.04 (Linux) O.P.S. 512mb RAM
    -- 2.66 Ghz Pentium Geforce NVidia 440 64mb

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

    Default

    Again with very general questions, my recommendation is that you click on Chris' link to start going through the tutorials.

  6. #6
    linux1man's Avatar
    linux1man is offline Member
    Join Date
    Nov 2008
    Posts
    39
    Rep Power
    0

    Default

    OK, thanks
    -- Ubuntu 8.04 (Linux) O.P.S. 512mb RAM
    -- 2.66 Ghz Pentium Geforce NVidia 440 64mb

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2010, 04:49 AM
  2. game
    By amith in forum AWT / Swing
    Replies: 0
    Last Post: 05-19-2008, 05:16 PM
  3. TicTacToe Game
    By Ebtihal in forum New To Java
    Replies: 0
    Last Post: 01-09-2008, 11:01 AM
  4. Programming a Game?
    By gt123 in forum New To Java
    Replies: 4
    Last Post: 01-01-2008, 12:41 PM
  5. Help with pong game
    By Eric in forum New To Java
    Replies: 2
    Last Post: 07-03-2007, 07:02 PM

Posting Permissions

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