Results 1 to 2 of 2
- 12-08-2011, 03:52 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 4
- Rep Power
- 0
Trying to make a Poker Dice game..!
Hi,
I'm new to java programming. And the way of thinking (like a programmer). I can't come up with an idea how I can fix the this obstacle.
I have now 5 dices that roll & random give a number from 1-6 after I rolled them I check them with a switch method to change it to king, dame, ... etc..
Now this is my problem.
I have no idea how I can check the dices with an 'if' statement if they rolled pairs, three of a kind, ... etc
Also I need to figure out how I can let the user chose what dices he want to keep and what the ones are he want to roll again.
I tried many things already! liek putting resultaat in a new array but seems java doesn't work that way ^^
my output is thisJava Code:public class Model { public Model() { } public static String roll() { int[] dobbels = new int[6]; Random rand = new Random(); String resultaat=""; String [] check = new String [20]; int i; for (i = 1; i < dobbels.length; i++) { dobbels[i] = rand.nextInt(7) + 1; resultaat+="u hebt gerold met dobbelsteen " + i + " een "; switch (dobbels[i]) { case 1: resultaat += "aas \n"; break; case 2: resultaat += "Boer \n"; break; case 3: resultaat += "Dame \n"; break; case 4: resultaat += "Koning \n"; break; case 5: resultaat += "10 \n"; break; default: resultaat += "9 \n"; } // System.out.println("Dobbelsteen " + i + " geeft " + resultaat); } return resultaat ; } }
Java Code:u hebt gerold met dobbelsteen 1 een 9 u hebt gerold met dobbelsteen 2 een 9 u hebt gerold met dobbelsteen 3 een Boer u hebt gerold met dobbelsteen 4 een Dame u hebt gerold met dobbelsteen 5 een 9
THANKS IN ADVANCE
and sorry for bad english
- 12-08-2011, 04:06 PM #2
Re: Trying to make a Poker Dice game..!
How would you do this by hand or in your head, without a computer? Pretend you have a really dumb friend who doesn't know anything about poker. Write out some simple rules that this friend can follow to achieve your goal. Remember, he's really dumb, so make sure your instructions are as simple as possible- if one instruction can be broken up into two instructions, do it. When you have that all written out, you'll have an algorithm that should be pretty easy to translate to code.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Dice Game
By Rachel1991 in forum New To JavaReplies: 1Last Post: 11-24-2011, 11:10 PM -
Pig Dice Game Help
By pvccstudent in forum New To JavaReplies: 3Last Post: 07-10-2011, 02:21 AM -
Pig dice game
By dangyounoobs in forum New To JavaReplies: 0Last Post: 06-12-2011, 06:57 AM -
Help with a dice game.
By hero in forum AWT / SwingReplies: 14Last Post: 07-26-2009, 11:50 AM -
help debugging a dice game
By Windoze in forum Advanced JavaReplies: 0Last Post: 11-16-2007, 10:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks