aspose file tools*
The moose likes Beginning Java and the fly likes Dice program. Help needed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Dice program. Help needed." Watch "Dice program. Help needed." New topic
Author

Dice program. Help needed.

dim ch
Greenhorn

Joined: Nov 09, 2005
Posts: 1
Greetings to everyone.

Assume that we have a dice program a very simple one, just prints line of information.
Imagine that we don't want to roll two sixes in any six consecutive roll, how can we do that?



thanks in advance
d.
[ November 09, 2005: Message edited by: dim ch ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4456
    
    6

here are some hints:

1. Keep track of when you last rolled a six.
2. When you roll a six, check how long ago it has been since you rolled the last six. If you think about it, you'll find it's really simple to calculate "how long ago". Only trick is how to set a value for "never". So, if the span between the two sixes is too short, just ignore the last six rolled.


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dice program. Help needed.