Computer Science Canada Dice Roll |
Author: | stef_ios [ Mon Apr 02, 2007 3:05 pm ] | ||
Post subject: | Dice Roll | ||
So i'm doing a dice rolling program. I want a single di to roll, and when the same number has been rolled, i want the program to stop and output the number that was rolle twice and the number of rolls it took to get that number to roll twice. I know it's simple. Here is the code I have so far:
Now the only thing I need help with is the part of the code that knows what number the dice lands on. I know I need to use randomize, but i'm not exactly sure what the code is, and where to put it in my program. Any help I could get wou;d be great! Thanks! |
Author: | Clayton [ Mon Apr 02, 2007 4:31 pm ] |
Post subject: | RE:Dice Roll |
Well, have a variable to keep track of what number Rand.Int returns, print it out on the screen, and then "roll" the dice again. |
Author: | nikoudov [ Sun Apr 15, 2007 5:24 pm ] |
Post subject: | RE:Dice Roll |
just add in "rand.int (x,y)" etc... and add in the useful variables to correspond with your dice rolls. |