Two Laptop Bag*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 4446

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]
It is sorta covered in the JavaRanch Style Guide.
subject: Dice program. Help needed.
Similar Threads
communication between objects (use of static int)
Using Methods in methods
So far...
for loop brain cramp!
help on Yahtzee