Thread: Help On Keeping Score For Dice Game

  1. #1
    Registered User
    Join Date
    Mar 2011

    Help On Keeping Score For Dice Game

    I'm new to this forum, so try to be easy on me. I don't have a background in programming so I'm not very familiar with advanced topics and/or lingo, but I'm sure you guys can explain it to me.

    I am creating a dice game (yahtzee) for my current programming class, obviously from scratch, and I need help with tallying the scores for the end of the round. If you're familiar with yahtzee you know you can get 3 of a kind, 4 of a kind, full house, small straight and large straight. I've figured out how to tally the scores for the easier categories (ones, twos, etc.) but I have NO idea on how to tally the scores for the previously mentioned categories.

    I'm confused on how to write the program to take some of the values and sum them up while omitting others. We have to display the dice for the user to see, and for example, if the outcome is 1, 2, 3, 4, and 6 and you want to place the values in the small straight category, I'm not sure how to tell the program to take the values 1-4 but keep the 6 out of the sum.

    Also, the user will choose a character (A-L) corresponding to each category depending on which one they want to score their roll in. That's an easy scanf statement, but I have no clue how to determine from the random values, which ones would correspond to a full house or the 3 & 4 of a kind categories. I can't say if (dice1 == dice 2) and follow with an instruction because they are random values and will obviously change with each roll.

    I hope this makes sense; if it doesn't I'll explain further.

    Thanks in advance guys,


  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Do you know the rules to Yatzee? That will tell you how to add the dice. Because that's all yatzee is, adding dice.

    Store each dice roll in a spot in an array of five elements. Prompt for each one (if you want to do it the easy way), and if it is to be rerolled, set that value to 0. Then, when you see what to reroll, anything that is set to 0 gets rerolled (gets a new dice value).

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Umm... help me find a Game Engine?
    By Hmph in forum Game Programming
    Replies: 8
    Last Post: 03-20-2011, 10:07 AM
  2. Extracting lowest and highest score from array
    By sjalesho in forum C Programming
    Replies: 6
    Last Post: 03-01-2011, 06:24 PM
  3. [freefps]Tactical Assault coders needed
    By Sickmind in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 05-07-2010, 05:06 PM
  4. Can anyone help?
    By javalurnin in forum C Programming
    Replies: 11
    Last Post: 12-02-2009, 06:02 AM
  5. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM