Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Assigning Values
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SwAnK




PostPosted: Fri Apr 15, 2005 6:49 pm   Post subject: Assigning Values

Hey I m making this game, and the first player rolls the dice. They roll 5 dice, and if they get three 1's, that is equal to 1000pts, or a striaght 1000pts, or if it is a single 1 then it is 100pts, and the rules go on. Im wanting to know how to do this, especially the 3 one rule?

also, i dont know how to quite put this but here goes. At the start you enter the number of plyers playing then the names. How do you assign each individual score to each plyer, and cycle through the players, because if they roll no pts on the dice their turn is over, and it moves to the next player.
thanx
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Fri Apr 15, 2005 7:41 pm   Post subject: (No subject)

For the dice:
You could keep a tally of the number of each number on the dice that turned up. So if you roll 1,6, 3, 2, 3, then the tally would look like this:
1: 1
2: 1
3: 2
4: 0
5: 0
6: 1
Of course, if you only care about ones, just keep a tally of ones. Once you've done that, use the number of ones (or whichever number) to give the player the appropriate amount of points. Don't forget to set the tally's back to 0 after the player's score has been calculated.
You would like to "cycle through the players". This suggests that you want to use the same code for different players. This means your life would be made a lot easier if you learned arrays.
Bored




PostPosted: Sat Apr 16, 2005 1:21 pm   Post subject: (No subject)

Another person is doing something a lot like this. http://www.compsci.ca/v2/viewtopic.php?t=8466. Look at my code it would work for this just have it edited so that it assigns points based on the number returned by the function
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: