• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with Pig-like dice game  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have project in school where you are suppose to create a "pig" singleplayer dice game.

In the game you're suppose to get to 100 with the least amount of rounds as possible. Getting a 1 will reset your score to 0 (or to the score you saved).You can save your score by typing "End".
I'm beginner at Java and am currently completely lost with no idea what to do.

The problem I'm having with the code is that after even after you've saved the points resets and it starts over. Help is greatly appreciated.

 
Marshal
Posts: 56605
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What is happening? And what did you expect to happen?
Have you been taught to write everything in one method? That is usually not a good idea.
 
Twelly Berg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch

What is happening? And what did you expect to happen?
Have you been taught to write everything in one method? That is usually not a good idea.


Thank you!

In the program I expect the points to be saved. When the points are saved and the user would hypothetically roll a 1, the points will be reset to the points that were last saved or 0 if the user haven't saved.
Currently, after the user have saved and rolls a 1 the points are reset completely.

I'm a pretty bad programmer and wasn't enrolled in this class by choice. So naturally, I just did what I thought would work. There are probably better and easier ways to code this program, I just don't know how.

 
Saloon Keeper
Posts: 3330
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't you need line 51 to be
 
Twelly Berg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:Wouldn't you need line 51 to be


Holy hell that fixed it. And it was so simple.

Thank you very much!
 
Carey Brown
Saloon Keeper
Posts: 3330
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Twelly Berg wrote:
Carey Brown wrote:Wouldn't you need line 51 to be


Holy hell that fixed it. And it was so simple.

Thank you very much!

You're welcome.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!