wood burning stoves 2.0
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

Dice program. Help needed.

dim ch

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
[ November 09, 2005: Message edited by: dim ch ]
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

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.
It's not a secret anymore!