• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with Pig-like dice game

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10705
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wouldn't you need line 51 to be
 
Twelly Berg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10705
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic