Results 1 to 2 of 2
  1. #1
    karibo is offline Member
    Join Date
    Nov 2011
    Posts
    4
    Rep Power
    0

    Question 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 ^^

    Java 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 ;
    
        }
    
    }
    my output is this

    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

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default 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

  1. Pig dice game
    By dangyounoobs in forum New To Java
    Replies: 2
    Last Post: 12-09-2013, 04:21 AM
  2. Dice Game
    By Rachel1991 in forum New To Java
    Replies: 1
    Last Post: 11-24-2011, 11:10 PM
  3. Pig Dice Game Help
    By pvccstudent in forum New To Java
    Replies: 3
    Last Post: 07-10-2011, 02:21 AM
  4. Help with a dice game.
    By hero in forum AWT / Swing
    Replies: 14
    Last Post: 07-26-2009, 11:50 AM
  5. help debugging a dice game
    By Windoze in forum Advanced Java
    Replies: 0
    Last Post: 11-16-2007, 10:28 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
  •