Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello I am working on a java packman for my programing class. The next step in t

ID: 3812905 • Letter: H

Question

Hello I am working on a java packman for my programing class.

The next step in this project is to add save states to the pacman game.

This is what the instructor wants

Finally, I want you to be able to save the current state of your program. So, if the user decides to save their current progress, they can and then resume at a later date. You should save the following:

a. Current location of the player

b. Current location of the monsters.

c. How many dots are left.

d. Current score.5

I am wondering what is the best way to do this? Thanks for the help

Explanation / Answer

One way to do this is to use a file.

Simply save the current location of players, monsters, number of dots left and the current score in a file.

You can use separate lines for different information. For example, the first line may have the location of player, second line has location of monsters, etc.

When the user wants to resume, do the following:

1. Read the file from the disk.

2. If file is not found, then give an error message to the user and ask if they want to start a new game.

3. If file is found, then read it and save the data to the corresponding variables. Notice that the data is in String format inside the file. So you have to properly convert the data to usable format.

4. Then continue with the program.

This seems pretty straightforward to me. The main focus of this assignment seems to be on how to retrieve the data properly from the file. You have to convert the data to proper format.

I do not have your exact programming details. So, I can't pinpoint any particular case. However, the outline is same as what I mentioned above.

If you have any particular concern in this approach, let me know in the comments section.

And you can always post the assignment details to get more help.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote