Results 1 to 6 of 6
Thread: Pig Game class plz HELP!!!
- 11-25-2008, 07:12 AM #1
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:
// 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.
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!
- 11-25-2008, 07:33 AM #3
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
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 11-25-2008, 10:46 PM #4
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
Again with very general questions, my recommendation is that you click on Chris' link to start going through the tutorials.
- 11-26-2008, 06:28 AM #6
- By JFlash in forum New To JavaReplies: 2Last Post: 08-05-2010, 05:49 AM
- By amith in forum AWT / SwingReplies: 0Last Post: 05-19-2008, 06:16 PM
- By Ebtihal in forum New To JavaReplies: 0Last Post: 01-09-2008, 12:01 PM
- By gt123 in forum New To JavaReplies: 4Last Post: 01-01-2008, 01:41 PM
- By Eric in forum New To JavaReplies: 2Last Post: 07-03-2007, 08:02 PM