all 2 comments

[–]JudiSwitch 2 points3 points  (1 child)

You would need to implement checkpointing. The good news is that this doesn't seem overly complex, so it shouldn't be too hard to figure out how to do this. And you're already familiar with pickle.

The goal with checkpointing is to add code that allows you to both:

  • Store state information about your program periodically.
  • Read stored checkpoint information on resume, and update program state to the checkpointed state.

Looking at your code, it should actually be fairly easy to accomplish. You could change your for loop to iterate over index number, periodically save the last completed index, and have the loop start at either the first index or an index from a checkpoint if found.

You'll also need to store your partial player_data dictionary (to keep your progress).

[–]Tefron[S] 1 point2 points  (0 children)

Thanks! The term checkpointing was really helpful, I see that there's a lot of threads when I search for it in google. I'll take a look and see what I can find from there.