Yahtzee

I am making a simple yahtzee program but it's not working right. Please look at this and tell me what I'm doing wrong. Thanks!
public class Yahtzee
public static void main()
int a, b, c, d, e;
Dice one = new Dice();
Dice two = new Dice();
Dice three = new Dice();
Dice four = new Dice();
Dice five = new Dice();
System.out.println("Let's play Yahtzee!");
one.roll();
two.roll();
three.roll();
four.roll();
five.roll();
a=one.getroll();
b=two.getroll();
c=three.getroll();
d=four.getroll();
e=five.getroll();
System.out.println(+b);
for(int i=0; i<6; i++)
if(a==i && b==i && c==i)
System.out.println("You have a three-of-a-kind");
if(a==i && b==i && d==i)
System.out.println("You have a three-of-a-kind");
if(a==i && b==i && e==i)
System.out.println("You have a three-of-a-kind");
if(a==i && c==i && d==i)
System.out.println("You have a three-of-a-kind");
if(a==i && c==i && e==i)
System.out.println("You have a three-of-a-kind");
if(a==i && d==i && e==i)
System.out.println("You have a three-of-a-kind");
if(b==i && c==i && d==i)
System.out.println("You have a three-of-a-kind");
if(b==i && c==i && e==i)
System.out.println("You have a three-of-a-kind");
if(b==i && d==i && e==i)
System.out.println("You have a three-of-a-kind");
if(c==i && d==i && e==i)
System.out.println("You have a three-of-a-kind");
if(a==i && b==i && c==i && d==i)
System.out.println("You have a four-of-a-kind");
if(a==i && b==i && c==i && e==i)
System.out.println("You have a four-of-a-kind");
if(a==i && b==i && d==i && e==i)
System.out.println("You have a four-of-a-kind");
if(a==i && c==i && d==i && e==i)
System.out.println("You have a four-of-a-kind");
if(b==i && c==i && d==i && e==i)
System.out.println("You have a four-of-a-kind");
if(a==i && b==i && c==i && d==i && e==i)
System.out.println("YAHTZEE!!!");
if(a==i && b==a+1 && c==a+2 && d==a+3)
System.out.println("You have a small straight");
}

I am making a simple yahtzee program Good for you.
but it's not working right. Oh dear. Care to tell us what is wrong?
Please look at this and tell me what I'm doing wrong. Thanks!Not in code tags. Sorry, don't look at code not in code tags and nicely formatted.

Similar Messages

  • I downloaded Yahtzee HD to my computer (windows 8).  Can't logate it except in the music section of itunes.  How do I open the game? Jack H

    I downloaded the ITunes Yahtzee HD game.  I can't locate it to start it on my coputer, even though it says it's there.  Did I miss something?

    Hi akamsj
    The file is a backup file, you can't open.
    If you wipe your device you can use this file to backup all the information in the device.
    You need to locate the file with Application Loader in Blackberry Desktop Manager. 
    If I help you with any inquire, thank you for click kudos in my post.
    If your issue has been solved, please mark the post was solved.

  • Yahtzee has frozen, is there a solution?

    My game of Yahtzee has frozen on my iPad, is there any solution I have tried reboot and reinstalling it, but nothing has worked

    Re FF5 and the RM plugin.
    I noticed that an embedded ram/rm file, invisible and with automatic start does play -- contrary to the same file type with play button, which triggers the crash.
    Hopefully there'll be a solution someday (soon)...

  • Troubles making yahtzee :(

    I would like you guys to review my code, I am currently having a lot of trouble with my Yahtzee problem, and i am wondering if there is an easier way to do this:
    My first problem is my counter... i have never done visual Java before, and my counter is set under my unlock the dice button(which i think could be removed) The counter doesnt count up, and i dont know why :S
    I also am having trouble with the hold buttons, i have them disableing the Label... but it still changes! Help me!!!
    Here is my code : [http://rapidshare.com/files/215380813/Final_Project.zip.html]
    Edited by: frolony on Mar 30, 2009 9:03 AM
    Edited by: frolony on Mar 30, 2009 9:04 AM

    The best way to get help is to post a SSCCE here.
    And Swing-related questions should be posted in the [Swing forum.|http://forums.sun.com/forum.jspa?forumID=57]

  • Problem with dices and panel

    hello,
    I have the following problem with my Yahtzee game:
    I use a class DicePanel with there on five instances of class 'Dice'. When you push the 'throw' button on the panel, I want the panel to check if there is actually something selected. Because if there's nothing selected there can't be thrown. (This would give problems with the 'throw counter', that's counting 1, 2, 3, 1, 2 ,3).
    I have tried a lot of things, but I always get this error:
    java.lang.OutOfStackError
    When you push on the throw button, first the dices are checked to be selected. I prefer to use a method for this, so i can write something like the following in the throw method:
    if( somethingIsSelected() ){
    blablabla
    or:
    if( !somethingIsSelected )
    return;
    My dices are in an array so i can check each dice witch a for-loop. After this for-loop some boolean should be false or true
    So my question is: how can i prevent the StackOverflowError??
    What seems to be the most logical way to work with 5 dices and one panel?
    excuse me for my bad English ;-)
    mzzl

    If you're getting a stack overflow, then you're probably recursing but not checking the end conditions properly.

  • Is Monopoly a possibility?

    My family now has a Scrabble game going all the time... and this has given me cause to wonder how possible it is to code Monopoly? Maybe there's a big committee meeting somewhere trying to decide it we'd all pay $10 instead of $5 or maybe Hasbro won't let it go to the iPod... I think there is quite a few folks who would buy it quickly.
    It seems if they can put a whole scrabble dictionary in, then they can code the 240 currency notes, 40 board spots, 12 Hotels, 32 houses, 16 Chance & 16 Community Chest cards, and 28 properties.
    of course there is the user interface side of this... a touch wheel could allow us to move around the board, I guess you'd need a pay screen to work out the Mortgaging when you're out of money - with choices on the rules (of course) The dice already work well from the Backgammon game. It could all work! The screen is small but there are a lot more iPod nano (3G) out there than iPhone/Touch's
    Is there a good place to request this?

    There is an element to these games that loses something in transition to the iPod. The counting of money for Monopoly and I think the addition at the end for Yahtzee. Scrabble has been good - I'm amazed that Monopoly loads quicker than Scrabble.
    Monopoly also seems to have no programmed money limit at the bank. I'm not used to a game not ending because everyone is getting richer - nobody wanted to trade and the richest person had $11,500 with no limit in sight. I suppose we could change the rules so that nobody gets $200 for passing go when the correct limit of money is reached.
    Hmmm... not sure I'd buy Clue. I didn't think they would animate the board so nicely for Monopoly. So how about Mousetrap!? I'm eyeing the pool game that looks like fun.
    I never thought I'd be using this iPod for games so much!

  • Cross checking values from two different arrays

    Hi there,
    I need some help with figuring out how to do this and hopefully someone here can help:
    I've got movieclips of dice called "dicePicked1", "dicePicked2", etc all the way to 6. each of these movieclips has a graphics on keyframes with labels "One" to "Six".
    Now I'm trying to find (in vain) a way to cross check the labels with arrays of numbers so that each time it finds a dicePicked with the appropriate label, it moves onto the next number to find. For example, I need to see if one of each dice has [1,2,3,4,5,6]. Once the program finds a dicePicked with the Label "One", it moves onto the next element which is 2 and so on.
    If it finds the last element (and thus all the elements), it returns true. If it doesn't find an element (for example none of the dicePicked have a Label "Three") then it returns false. I'm trying to find a system that can accommodate different combinations and some with the same numbers multiple times (for example 3 different dicePicked have the label "three")
    I'm having alot of trouble figuring out a good system for this and any help would be awesome!
    Thanks and let me know if anything is unclear!

    Unfortunately, your example lost me on the first roll... I don't see the combination in choosing the 1 and the 5 for 150 points.  That would have me think that the roll with the 4 could be kept for 40 points.  Also, I didn't see where getting a 5 or a 1 for the last roll would have yielded something.
    Anyhow, if you look at what I did for the Yahtzee game, each possible combination has a function dedicated to testing for it.  The difference with Yahtzee being that you have to choose which scoring element you use up for each turn, whether you earn that scoring element or forfeit it.  Also keep in mind that I created that tangle of code when I was a youngin' in the programming realm, so there may be cleaner ways of dealing with things.
    Since you appear to be automating the scoring process, you likely need to have something first detect that the "hold these" action has taken place and then do some evaluation on those held thru a top-down series of checks (meaning highest scoring combinations to lowest), and accept the first that fills the bill.  I don't understand the logic as to why a 1 and a 5 score anything, but in any case, your code would need to have a test for that scenario.  And if having the last die be a 1 or a 5 also scores, then you would need to retain something relative to that relkating to the 1 and 5 being selected earlier.

  • Help with creating a method within a class

    I need help creating another method within the same class.
    Here is part of my progam, and could anyone help me convert the switch statement into a seperate
    method within the same class?
    import javax.swing.JOptionPane;
    public class Yahtzee
         public static void main (String[] args)
              String numStr, playerStr, str, tobenamed;
              int num, times = 13, roll, x, y, maxRoll = 3, z = 0, t;
              int firstDie, secondDie, thirdDie, fourthDie, fifthDie, maxDie = 5, reroll;
              int rerolling = 0, categoryChoice, score, nextDie1, nextDie2, nextDie3, nextDie4;
              Die die1, die2, die3, die4, die5;
              do
              numStr = JOptionPane.showInputDialog ("Enter the number of player: ");
              num = Integer.parseInt(numStr);
              while (num < 1 || num > 6); //end of do loop
              String [] player = new String[num];
              // boolean //finsih later to make category choice only once.
              for (x = 0; x < num; x++)
                   playerStr = JOptionPane.showInputDialog ("Name of Player" + (x + 1) + " :");
                   player[x] = playerStr;  
              } //end of for loop
              die1 = new Die();
               die2 = new Die();
               die3 = new Die();
               die4 = new Die();
               die5 = new Die();
              int scoring [][] = new int [num][13];//scoring aray
              int[] numDie = new int[maxDie];
              String[][] usedCategory = new String [num][times];
              for (x=0; x < 13; x++)
                   for (y = 0; y < num; y++)
                      usedCategory[y][x] = " ";
              for (int choices = 0; choices < times; choices++)
                   //player turns for loop.
                   for (x = 0; x < num; x++)
                        //rolls the die;
                          for (y = 0; y < maxDie; y++)
                               numDie[y] =  die1.roll();
                     numStr = JOptionPane.showInputDialog (player[x] + "\n~~~~~~~~~~~~~~~~~~~~~~~"
                                                                            + "\nDie1: " + numDie[0]
                                                                                + "\nDie2: " + numDie[1]
                                                                                + "\nDie3: " + numDie[2]
                                                                                + "\nDie4: " + numDie[3]
                                                                                + "\nDie5: " + numDie[4]
                                                                                + "\nWhich dice do you want to reroll");
                    reroll = numStr.length();
                    if (reroll == 0)
                        t = maxRoll;
                   else{                                                      
                    //reroll
                         for(t = 0; t < maxRoll; t++ )
                             for (y = 0; y < reroll; y++)
                                    rerolling = numStr.charAt(y);
                                 //create another mwthod later.
                                    switch (rerolling)
                                         case '1':
                                              numDie[0] =  die1.roll();
                                              break;
                                         case '2':
                                              numDie[1] =  die1.roll();
                                              break;
                                         case '3':
                                              numDie[2] =  die1.roll();
                                              break;
                                         case '4':
                                              numDie[3] =  die1.roll();
                                              break;
                                         case '5':
                                              numDie[4] =  die1.roll();
                                              break;
                                         default:
                                         t = maxRoll;//to be changed
                                    } //end of switch class
                              }//end of reroll for loop
                                   JOptionPane.showMessegeDialog (player[x] + "\n~~~~~~~~~~~~~~~~~~~~~~~"
                                                                                      + "\nDie1: " + numDie[0]
                                                                                          + "\nDie2: " + numDie[1]
                                                                                          + "\nDie3: " + numDie[2]
                                                                                          + "\nDie4: " + numDie[3]
                                                                                          + "\nDie5: " + numDie[4]
                                                                                          + "\nWhich dice do you want to reroll"
                                               switch (rerolling)
                                         case '1':
                                              numDie[0] =  die1.roll();
                                              break;
                                         case '2':
                                              numDie[1] =  die1.roll();
                                              break;
                                         case '3':
                                              numDie[2] =  die1.roll();
                                              break;
                                         case '4':
                                              numDie[3] =  die1.roll();
                                              break;
                                         case '5':
                                              numDie[4] =  die1.roll();
                                              break;
                                         default:
                                         t = maxRoll; //not really anything yet, or is it?
                                    } //end of rerolling switch class
                                       //categorychoice = Integer.parseInt(category);
                              }//end of t for loop            
                   }//end of player for loop.

    samuraiexe wrote:
    well, i should have said it is a yahtzee program, and i ask the user what they want to reroll and whatever number they press, the switch will activate the case and the array that it will reroll.
    HOw would i pass it as an argument?You put it in the argument list. Modifying your original code a bit:
    public static void switchReroll (int[] dice, int position) {
         switch (position) {
         case '1':
                 dice[0] =  die1.roll()
                 break;
         case '2':
                 dice[1] =  die1.roll();
                 break;
         case '3':
                 dice[2] =  die1.roll();
                     break;
         case '4':
                 dice[3] =  die1.roll();
                 break;
         case '5':
                  dice[4] =  die1.roll();
                 break;
         default:
                 t = maxRoll;//to be changed
        } //end of switch
    }which you could then call as this:
    switchReroll(numDie, reroll);Note that your code still isn't done; the above won't compile. This is just an example of how you could pass the stuff as an argument (and note how the values have different names in the main method than in the switchReroll method -- this works, but also note that it's the same array of ints in both).
    By the way -- you really don't need a switch statement for this. You can do the same thing with a couple lines of code, which would lessen the advantage for a separate method. But I'd suggest continuing down this path, and then you could change the implementation of the method later.

  • USB devices causing G5 meltdown

    A friend purchased a used G5 Dual 2.5GHz running a fresh install of 10.4.x. The machine runs fine when no USB devices are attached, but consistently crashes when a USB device is connected. Both the Maxtor external HDD and Pro Tools external audio Interface (Mbox2) result in the same behavior. The computer attempts to go to sleep and never wakes up, with the fans humming at full strength. Without the USB devices attached the machine can go to sleep without problems.
    This occurs with both the front USB ports and the rear (Althoug I assume these are connected to the same controller?) The keyboard and mouse can remain connected without issues. It would appear that the USB hardware is the original.
    Thoughts, next troubleshooting steps?
    Much appreciated,
    Jon

    Ah, the good ol' cinema display. We may have Yahtzee.
    That would most likely be your problem. The hubs built into those monitors are prone to failure. It is especially bad if you chain a mouse of the keyboard ports.
    Try leaving the hub connections from the monitor disconnected and plug the mouse and keyboard each into its own USB port on the Mac and try that. If it works and you still need a hub try a standalone powered USB hub.

  • 1.2 Problem with Bubbles and Music App

    Ok, so I updated to WebOS 1.2.0, Sprint Configuration 1.8. There are 2 apps that I use all the time on the phone: Music player (via BT headphones) and the games Bubbles (Im addicted to it). Once I updated to 1.2.0 I have noticed that when the 2 of these if I attempt to play bubbles, it will allow the music to play for an additional 20 seconds or so and then the music will pause. I have tried this with the palm headphones plugged in and got the same result. I also tried removing bubbles and reinstalling from the App Store. Again, the same result.  The music app will continue to play as long as I dont play the Bubbles game. It doesnt matter which card is in focus, as soon as i tap on the bubbles it pauses. Any thoughts?
    Post relates to: Pre p100eww (Sprint)
    Message Edited by awbishop on 09-28-2009 07:34 PM

    Yep, definitely a glitch with Bubbles.  Though I have also noted that once you begin playing the game and tap Play on the music player, if you turn the game sounds off, the music continues to play uninterrupted in the background while you play the game.
    I don't have much else in games, but neither Tic-Tac-Toe or Yahtzee are causing the same problem for me.
    p.s.  email notification is working just fine
    Message Edited by smkranz on 09-29-2009 10:52 AM
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

  • Games for the Nano?

    I cant find games that will work for the nano on itunes. what BS are they trying to pull with only games for the touch and iphone?

    I've read a lot of the posts on this forum, but I don't seem to see a real answer to this question. Most responses just seem to point to where the clickwheel games are listed. However, as some others have said on other posts, although the top of that page states that these games are compatible with 3rd, 4th, and 5th generation iPod nano (and a few other iPod models), if you look at the individual game descriptions, not a single one lists 5th generation nano. One (I forget which) only lists 3rd gen, and all the others list 3rd and 4th. So, it is not at all clear if any of these will work on the 5th generation nano. So just saying where the clickwheel games are doesn't really help.
    I don't have time to read every comment on every game (especially when most of them are like, "Hey Apple - we want free games!" or "Make Guitar Hero!"), so I am hoping that someone here will have some answers. I have managed to glean that the .99 games of Chinese Checkers and Reversi don't work on 5th generation because parts, but not all, of the images are reversed so things don't line up. I did find one post on this forum that said that Monopoly does work. Can anybody say from their own experience which games they have tried on 5th gen, and which ones worked or didn't work? If you have any opinions on the games themselves, that would be great, too - for example, when I was reading about Yahtzee, apparently the computer plays like a moron so it's not worth playing the computer on that one.
    I won a 5th gen nano at my office Christmas party, and am a complete novice at this, so any help is appreciated! I am really enjoying the games that came loaded on it, and would like to add some more, but I am not sure there are any on iTunes that actually work with this specific model.
    TIA!!!!!!

  • Shortcut to open RAW image directly into Photoshop

    Isn't there a keyboard/mouse shortcut that will allow someone to open a RAW image from within Lightroom directly into Photoshop...and in the process, bypass the 'Edit Type Options' dialog (i.e. Edit Original; Edit Copy with Lightroom Adjustments; Edit Copy)??
    I could have sworn that I had read somewhere in Martin Evening's Lightroom for Photographers 1.1 addendum that there was a way to do this (I recall it was something along the lines of holding down the option/alt key while choosing 'Edit in Photoshop from the contextual menu, or maybe it was a direct hotkey that could be entered simply by selecting the image and pressing the defined hotkey) - or maybe I am crazy and I am totally making this up :O
    Anyone know what the magic password is for this?
    Any suggestions would be greatly appreciated... Thanks!

    Wow!
    Michael D Sullivan...Part of me really wants to strangle you right now...but, I will resist, as I am not the type to flame people on forums/chat groups...those people are lame...
    Nonetheless, you are completely missing my point...STILL!!
    You had mentioned:
    >The only way to open a RAW file in Photoshop directly is through Camera Raw.
    Really? Come on dude...You don't think I knew that...my grandmother who has never used Photoshop in her life knows that much...Try to extrapolate meaning from someone's post prior to writing back with a ridiculous response like that...
    Then you went on to say:
    >It's that or convert it to a TIFF/PSD file and edit in Photoshop.
    Yahtzee! Someone give this guy a cigar! (i.e. Yes Michael, this is what I meant)...Let's review my response to the initial (legitimate) confusion about the post I'd started this thread with...shall we?
    I responded to the intial confusion (Posts #2, #3) about my original post (Post #1) by saying:
    >I would like to have a way in which, using a keyboard/mouse shortcut of some sort, I could open a RAW file
    WITH THE LIGHTROOM ADJUSTMENTS APPLIED, directly into Photoshop, thereby bypassing the 'Edit with Photoshop CS3' options window all-together (and in the process of opening this RAW file, obviously Lightroom would convert the RAW image into a TIFF file...)
    I am sorry Michael, but I don't think I can dumb this down any further...I even went so far as to state:
    >"(and in the process of opening this RAW file, obviously Lightroom would convert the RAW image into a TIFF file...)".
    I hope you were in a bad mood and just felt like being a d&#k when you responded to that post with:
    >"Read my post, #2. There's no copy involved. The only way to open a RAW file in Photoshop directly is through Camera Raw."
    Do you honestly think I didn't understand that? Do you still honestly not get what I am talking about?
    Let me give you a visual...
    Have a look at this screenshot
    Then view this one
    Have we reached Nirvana yet? Do we feel enlightened? Have we gained any more clarity on the situation yet?
    If not, then you're wasting my time!
    If so...well...there's not going to be an if so, is there Michael? I figure that the chances of you responding to this post with anything meaningful is unlikely at best...
    Oh well...Have a nice day!

  • Flash content hard crashes computer, no matter what I do

    I have gone to the end of the earth to find a solution to this problem and I cannot figure it out.
    I've tried older video drivers(nvidia, gtx460), I've tried newest, a little older.
    I've tried as many different versions of Flash player I could find
    Both combinations of flash player and video driver have been interchanged with more combinations than a Yahtzee dice game.
    Computer build is less than a year old.
    This crash was happening for a couple weeks very intermittently, then it got worse, then one of the lockups CAUSED BY FLASH to caused my operating system to become corrupt. THEN, even after a full format and reinstall, FLASH STILL CRASHED MY COMPUTER.
    Every single piece of computer hardware has been stress tested and temperature monitored.
    New PSU was installed (corsair hx750)
    Tried a different Graphics card.
    Nothing. And I mean NOTHING. Stops my computer from hard crashing from flash content(videos mostly).
    It causes either a complete powerdown INSTANTLY, then my computer restarts. OR the other crash it does is complete LOCKUP with a horrible sounding static sound loop.
    Please help!

    All I can really say about that is that you're the only person I'm seeing complaining of these systems.  With 1.2 billion users, we'd be hearing about it if Flash was somehow magically able to cause this through normal operation (it's not).  The fact that your machine is powering off points to a hardware problem. 
    If you feel that you've exhausted your troubleshooting efforts there and are able to use the computer successfully without Flash Player installed, I'd recommend uninstalling:
    Uninstall Flash Player | Windows
    Alternatively, if you have a sound card that isn't built onto the motherboard chipsets, you might yank it and see if your system stability improves, since it sounds like you've done that with the video card already.

  • Images not loading when I run my JAR

    I created a Yahtzee game that contains five die images. When I created the JAR file, I explicitly added the source and images to it. But when I go to run the app, no die images show up. I referenced Java's Creating a JAR File tutorial (http://java.sun.com/docs/books/tutorial/deployment/jar/build.html) but I didn't find anything useful regarding my issue.
    My Images folder is under my classes folder: Yahtzee\build\classes\Images
    I create the JAR from within classes and I add the die images that are in Images by using change directory option -C.
    jar cvfm Yahtzee.jar Manifest.txt *.class -C Images/ .
    I'm using the verbose option v, which allows me to see every file that gets added to the JAR, so I know there's no problem with missing files.
    Any thoughts?
    Message was edited by:
    d_mart

    By the way I'm adding the images into the JAR, they should be in its root.
    This is what I'm doing with my code. I have five die buttons that get a random die face, which are represented with my die images. I have an up-state (unselected) and a down-state (selected) image for each die face (1, 2, 3, 4, 5, 6). I have two different states because just like poker, you keep the cards that you want and disgard the ones that you don't want and in return, you get some random card for every card that you disgarded. So the selected and unselected images should be self-explanitory now. In Yahtzee, you have up to three rolls per hand, which I have a button that handles the rolls (<=3). I have stored my die images in a 2D array.
    My image file names are as follows:
    d1up.png, d1down.png, d2up.png, d2down.png,...d6up.png, d6down.png
    private Icon [][] dieImages;
    private Icon defaultDieImage;
    private Die [] dieButtons;
    // INITIALIZE DIE IMAGES
    defaultDieImage = new ImageIcon("../Yahtzee/src/Images/blank.png");
    dieImages = new ImageIcon[2][6];
    for(int i = 0; i <= 5; i++) {
         // up state images
         dieImages[0] = new ImageIcon("../Yahtzee/src/Images/d"
    + (i + 1) + "up.png");
    // down state images
    dieImages[1][i] = new ImageIcon("../Yahtzee/src/Images/d"
    + (i + 1) + "down.png");
    Those images are then loaded into the die buttons (depending on the roll).
    FYI, I just finished my 2nd semester of Java, so I'm still pretty new to the language and it's the only language that I know so far. With that said, please forgive for any dumb mistakes. It's all good though, I learn something new everyday. So you say that I should be using something like getClass().getClassLoader().getResource("an_image.jpg"); in my code instead of what I have?
    I hope the information that I provided helps.
    Dan

  • Java BlueJ Help

    In the following code i need to find the round Number (yahtzee game) with a max rounds at 13 and once the limit is reached the round returns to 1 but is initialized to 0. I am having trouble where i am using the JUnit testing and the round number is suppose to be one but returns zero.
    /** The Match class is the main ``controller'' of the yahtzee match. 
    A Match sequence is as follows: each player gets to play their turn in
    the first round,
    then each player gets to play their turn in the second round, and so on
    until all MAXROUNDS
    (13) rounds have been played for the first game.  Then each player gets
    to play the first round for the second game, and so on...
    The Match class controls the following:<P>
        <UL>
        <LI> which Player plays next, and which is the current Player;
            <LI> the round number (0 through MAXROUNDS-1);
        <LI> the game  number (0 through MAXGAMES-1).
            </UL>
    public class Match {
      /** The maximum number of players allowed per match. This
          value must be 5 when the class is submitted. */
      public final static int MAXPLAYERS = 5;
      /** The maximum number of games per match. This value must be 5 when
          the class is submitted. */
      public final static int MAXGAMES = 5;
      /** The maximum number of rounds per game. This value must be 13 when
          the class is submitted. */
      public final static int MAXROUNDS = 13;
      private Player[]players;
      private int currentPlayer;
      private int numPlayer;
      private int numGames;
      private int numRound;
      /** Constructor for the match.  Initialises the number of players, the
        game number, the round number, and the current player number all  to
        zero.
      public Match() {
          players = new Player[MAXPLAYERS];
          numPlayer = 0;
          numGames = 0;
          numRound = 0;   
          currentPlayer = 0;   
      /** Instance method which adds a named player into the set of players
          and adds one to the total number of players.
      public void addPlayer(String name) {
          Player details = new Player(name);
          if(numPlayer < MAXPLAYERS){
              players[numPlayer++] = details;}
      /** Instance method which returns the number of players.
          The number returned is in the range 0 to MAXPLAYERS.
          Returns zero only when no players have yet been added through
          addPlayer().
      public int getNumPlayers () {
          return numPlayer;
      /** Instance method which returns the Player who's turn it is. */
      public Player getCurrentPlayer () {
          return players[currentPlayer];
      /** Instance method which returns the specified Player.
          @param playerNum numerical identifier for the player.  Must be
          in the range 0 to n-1, where n is the number of players in the game.
      public Player getPlayer (int playerNum) {
          return players[playerNum];
      /** Instance method which advances to the next Player.  If this is the
        last Player then advance to the next round. If this is the last
            round, then advance to the next game.
      public void nextPlayer() {     
          currentPlayer++;
          if(currentPlayer == numPlayer){currentPlayer = 0;numRound++;};
      /** Instance method which returns the number of the current game.
          The number returned is 0 or greater (zero for the first game). 
          Note that the graphical user
          interface is responsible for quitting the game when the game number
          advances to MAXGAMES
      public int getGameNum () {  
          return numGames;
      /** Instance method which returns the number of the current round.
          The number returned is in the range 0 to MAXROUNDS-1. */
      public int getRoundNum() {
          int result = 0;
          if(numRound == 0){numGames++;};
          if(numRound <= MAXROUNDS-1){     
          result =  numRound;}
          return result;
    }

    If I get you right, I'd change two things:
    1.) Have nextPlayer() do the round check, i.e.
    if (++numRound == MAXROUNDS) {
      numRound = 0;
    }2.) Have getRoundNum() just return numRound + 1 (making the 0-based variable a 1-based counter)
    If there's no urge for you to have numRound 0-based, you can also make it 1-based.

Maybe you are looking for

  • Music Taking Up too Much Space on my hard drive...

    Need some assistance... Have download approx. 30g. of Music Files on my 60 g. 5th. Generation iPod. At the same time I now have 30 g. of back-up files on my laptop hard drive....The music files are now taking up too much memory. I bought an 80 g. ext

  • Layout help

    hey im have a serious problem with the layout manager. i started programing using the netbeans ide's null layout manager, and only now i found it that when changing the resolution it messes up eevrything. i tried using diffrent layouts, but nothing w

  • Can't Download New or Updated Already Installed Apps?

    When I try to purchase a new app or update apps already on my iPhone 4S i get an error message that reads "an unkown error has occured" and the downloads are stoped before they even start. This seems to have happened to me at the same time I set up m

  • Changes to iMovie 2013

    What changes have occured between iMovie 2011 and iMovie 2013, both positive and negative?

  • Router string problem

    dear all what is the JCO connection attribute which equal  the router string in the sap GUI so i can but the  router string IP like /H/10.0.0.50 /H/ in the java code