File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dice program. Help needed.

 
dim ch
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 6547
21
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic