Thread: Help With Dice Game

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    16

    Help With Dice Game

    Thank You So Much For All The Help
    Last edited by CaliJoe; 03-11-2009 at 04:34 PM.

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    42
    In case you didn't notice, there's an error here so it wouldn't even compile:

    Code:
    if (sum % 2 == 0)
               {even++;          
                   if (even==1)
                   {eve n=even+1;
                   eventotal=even;}
                   else
                   {even=even;}}
    Also, there's some "confusions". Instead of having all those functions, forget about even and uneven variables.

    Have a variable for dice1, dice2 and sum of both dices.

    Make a function (bool) that receives an integer and returns true if it's even, false if it isn't.

    When you want do add the points, use the function to check if the sum of both dices is even. If true, increment player1 score. Else, increment player2.

    Also, you don't really need to call the Dice function with three attributes, do you?
    Why don't you just make function Dice return the sum of both dices, and move from there?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Dice game: How to handle 2 players and separate totals?
    By crazychile in forum C Programming
    Replies: 7
    Last Post: 10-20-2008, 12:01 AM
  3. Need book to program game into multiplayer...
    By edomingox in forum Game Programming
    Replies: 3
    Last Post: 10-02-2008, 09:26 AM
  4. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM