Results 1 to 1 of 1

Thread: Player Score

  1. #1
    glockner is offline Member
    Join Date
    Jan 2015
    Posts
    31
    Rep Power
    0

    Default Player Score

    I have an instance variable for Player Score called pScore. To calculate the pScore I need to add the round score if and only if 1's are not rolled. I have a method called playerHolds that sets pScore = pScore , rScore = 0 , and then prints the pScore. But in this method posted below I am not sure how to calculate the pScore correctly...

    Java Code:
    private void rollDice(){
            //Declare variables for values of both dice
            int val1;
            int val2;
            
            //Roll both dice
            d1.roll();
            d2.roll();
            
            //Assign the value rolled by each die to given value
            val1 = d1.getValue();
            val2 = d2.getValue();
            
           //Set values of Round Score and Player Score depending on roll of dice
           if(val1 == 1 || val2 == 1){
                rScore = 0;
            }
            else if (val1 + val2 == 2){
                pScore = 0;
                rScore = 0;
            }
            else{
                rScore += val1 + val2;
            }
            
            
            System.out.println("" + val1 + " " + val2 + " Round Score: " + rScore);
            
        }
    Last edited by glockner; 02-26-2015 at 03:08 AM.

Similar Threads

  1. Replies: 1
    Last Post: 12-18-2013, 03:22 AM
  2. solr score
    By belsen in forum Lucene
    Replies: 0
    Last Post: 11-16-2010, 03:04 PM
  3. Klaverjas Score 0.2
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-23-2007, 07:40 AM

Posting Permissions

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