With the code that we made the save/load system crashes the game.
So here is the full code I'm using (330 lines or so)

```
from os import stat
import time
import random
import math
import pickle
import os.path
file_exists = os.path.isfile("loadfile.txt")

class Character(object):
    def __init__(self, name, maxHP, shield, damageAbsorption, attack, dodge, money):
        self.name = name
        self.maxHP = maxHP
        self.HP = maxHP
        self.shield = shield
        self.damageAbsorption = damageAbsorption
        self.attack = attack
        self.dodge = dodge
        self.money = money

    def takeDamage(self, damagePoints):
        ad = damagePoints * (100-self.damageAbsorption)/100.0
        if(ad < 0):
            return
        elif ad < 0.1:
            ad = 0.1

        if (self.shield - ad) >= 0:
            self.shield -= ad
            ad = 0
        else:
            ad -= self.shield
            self.shield = 0
            self.HP -= ad
            if self.HP <= 0:
                self.death()
        return ad

    def death(self):
        print(f"{self.name} died")

    def show_stat(self):
        print(f"{self.name}: ")
        print(f"HP/MaxHP: {self.HP}/{self.maxHP}")
        print(f"shield: {self.shield}")
        print(f"damage absorption: {self.damageAbsorption}%")
        print(f"attack: {self.attack}")
        print(f"dodge: {self.dodge}%")
        print(f"possessed treasure: {self.money}")

class Player(Character):
    def CreatePlayer(maxHP, shield, damageAbsorption, attack, dodge, money):
        print("*******************")
        s = input("This is the adventure of ..")
        return Character(s, maxHP, shield, damageAbsorption, attack, dodge, money)

    def __init__(self):
        pass

class Waynode(object):
    def __init__(self, type):
        self.type = type

class Game(object):
    player = Player()

    @staticmethod
    def input_instructions():
        print("\n<------commands------>")
        print("y/n - yes/no")
        print("help - open help menu")
        print("stat - show player stats")
        print("save - saves the game")
        #print("save - save game")
        print()

    @staticmethod
    def input_handler():
        s = input()
        if(s == "y"):
            return "True"
        elif(s == "n"):
            return "False"
        elif s == "stat":
            Game.player.show_stat()
            return "stat"
        elif(s == "help"):
            Game.input_instructions()
        elif s == "save":

            Game.askSave()
        elif s == "load":
            Game.load()
            return ""
        else:
            return s  # i am encountering a bug

    @staticmethod
    def askSave():
        ask = input("Do you want to save?\n--> ").upper()
        if ask == "Y" or ask == "YES":
            # Saves the desired class AND a chosen attribute
            print(Game.player.name)

            Save = Player(Game.player.name)
            # Creates the file and puts the data into the file
            pickle.dump(Save, open("save.dat", "wb"))
            # The file doesn't have an extension because it is a binary file and makes it easier to parse.
        elif ask == "N" or ask == "NO":
            print("Okay, maybe next time!")
            return
        else:
            print("Sorry, that does not compute with me! Please try again!")
            Game.askSave()

    @staticmethod
    def load():
        me = pickle.load(open("save.dat", "rb"))  # Loads the file
    # Prints the stats out to verify the load has successfully happened
        me.display(Player.display)

    @staticmethod
    def combat(turn):
        print()
        enemy = Character(f"enemy {random.randint(0,100)}", 2+turn/2, 0, math.sqrt(
            turn+1), turn/5, 20, random.randint(int(turn/2+5), int(turn/2 + 20)))
        enemy.show_stat()
        print()

        isPlayerTurn = random.choice([True, False])
        while Game.player.HP > 0 and enemy.HP > 0:
            time.sleep(1)
            if(isPlayerTurn):
                ran = random.randint(0, 100)
                if(ran <= enemy.dodge):
                    print(
                        f"{enemy.name} dodged {Game.player.name}'s attack ({enemy.dodge}%)")
                else:
                    ad = enemy.takeDamage(Game.player.attack)
                    print(
                        f"{Game.player.name} attacked {enemy.name} and deal {ad:.1f} damage (shield: {enemy.shield:.1f})")
            else:
                ran = random.randint(0, 100)
                if(ran <= Game.player.dodge):
                    print(
                        f"{Game.player.name} dodged {enemy.name}'s attack ({Game.player.dodge}%)")
                else:
                    ad = Game.player.takeDamage(enemy.attack)
                    print(
                        f"{enemy.name} attacked {Game.player.name} and deal {ad:.1f} damage (shield: {Game.player.shield:.1f})")
            isPlayerTurn = not isPlayerTurn

        print()

        if Game.player.HP <= 0:
            print(f"Game Over! turn:{turn}")
            Game.player.show_stat()
        else:
            print(f"you defeated {enemy.name}!")
            Game.player.money = Game.player.money + enemy.money
            print(f"you gained {enemy.money} coins")
            a = random.randint(5, 20)
            a = a/10
            Game.player.attack = Game.player.attack+a
            print(f"+{a} attack")
            d = random.randint(0, 10)
            d = d/10
            Game.player.dodge = Game.player.dodge+d
            print(f"+{d} dodge")
            b = random.randint(2, 10)
            b = b/10
            Game.player.damageAbsorption = Game.player.damageAbsorption+b
            print(f"+{b} damage absorption")
        print()

print("Welcome, Adventurer!")
time.sleep(1)
print("are you ready for a new adventure?(y/n)")

s = Game.input_handler()
while s != "True" and s != "False":
    print("please type again!(y/n)")
    s = Game.input_handler()

if s == "True":
    print("Great! you will be teleported to the entrance soon. " +
          "Remember you can always type \"help\" to read input commands and \"stat\" to see player's status")
    time.sleep(1)

    Game.player = Player.CreatePlayer(5, 2, 0, 1, 5, 50)
    Game.player.show_stat()
    print("*******************")
    print()

    turn = 1
    while Game.player.HP > 0 and Game.player.money <= 200:
        # before turn update
        # begin turn
        print(f"<---- turn {turn} ---->")
        ran = random.randint(1, 5)
        dialog = f"there are {ran} ways ahead.\n"
        ways = []
        for x in range(1, ran+1):
            ra = random.randint(1, 3)
            if ra == 1 or ra == 2:
                dialog = dialog + f"the way {x} is quiet, "
            elif ra == 3:
                dialog = dialog + \
                    f"{Game.player.name} hears noise come from depths in the way {x}, "
            ways.append(Waynode(ra))
        dialog = dialog[:-2]
        dialog = dialog + ".\n"
        print(dialog)
        time.sleep(2)
        num = input("which way you choose?(type number)")
        while True:
            if not num.isdigit():
                num = input("which way you choose?(type number)")
                continue
            else:
                n = int(num)
                if n <= 0 or n >= ran+1:
                    num = input("which way you choose?(type number)")
                    continue
                else:
                    break
        print(f"{Game.player.name} enters way {num}")
        n = int(num)
        time.sleep(1.5)

        if(ways[n-1].type == 1):
            ran = random.randint(1, 100)
            if ran <= 20:
                print("Nothing here!")
            elif ran <= 40:
                m = random.randint(5, 15)
                Game.player.money += m
                print(f"you found some coins in the chamber. (money + {m})")
            elif ran <= 60:
                Game.player.shield = Game.player.shield+3
                print(
                    f"you found a sturdy shield in the chamber. (shield+3)(total: {Game.player.shield})")
            elif ran <= 70:
                if(Game.player.HP + 3 > Game.player.maxHP):
                    Game.player.HP = Game.player.maxHP
                else:
                    Game.player.HP = Game.player.HP+3
                print(
                    f"you found a small healing potion in the chamber. (health+3)({Game.player.HP}/{Game.player.maxHP})")
            elif ran <= 90:
                Game.player.maxHP = Game.player.maxHP+1
                print(
                    f"you found a small crystal of blood in the chamber. (max HP+1)({Game.player.HP}/{Game.player.maxHP})")
            else:
                m = random.randint(20, 30)
                Game.player.money += m
                print(
                    f"you found a small pocket in the chamber. (money + {m})")

        elif(ways[n-1].type == 2):
            ran = random.randint(1, 100)
            if ran <= 30:
                print("Nothing here!")
            elif ran <= 40:
                m = random.randint(5, 15)
                Game.player.money += m
                print(f"you found some coins in the chamber. (money + {m})")
            elif ran <= 60:
                if(Game.player.HP + 3 > Game.player.maxHP):
                    Game.player.HP = Game.player.maxHP
                else:
                    Game.player.HP = Game.player.HP+3
                print(
                    f"you found a small healing potion in the chamber. (health+3)({Game.player.HP}/{Game.player.maxHP})")
            elif ran <= 80:
                Game.player.maxHP = Game.player.maxHP+1
                print(
                    f"you found a small crystal of blood in the chamber. (max HP+1)({Game.player.HP}/{Game.player.maxHP})")
            elif ran <= 90:
                Game.player.shield = Game.player.shield+1
                print(
                    f"you found a broken shield in the chamber. (shield+1)(total: {Game.player.shield})")
            else:
                Game.player.attack = Game.player.attack+1
                print(
                    f"you found a broken sword in the chamber. (attack+1)(total: {Game.player.attack})")

        else:
            ran = random.randint(1, 100)
            if ran <= 10:
                print("Nothing here! Maybe i am too nervous")
            elif ran <= 20:
                m = random.randint(5, 15)
                Game.player.money += m
                print(f"some coins in the chamber. (money + {m})")
            elif ran <= 30:
                Game.player.maxHP = Game.player.maxHP+3
                print(
                    f"you found a large crystal of blood in the chamber. (max HP+3)({Game.player.HP}/{Game.player.maxHP})")
            else:
                print("you encounter an enemy!")
                time.sleep(1)
                Game.combat(turn)

        time.sleep(1)
        print()
        print("ready for next turn? (y/n)")
        s = Game.input_handler()
        while s != "True":
            print("please type again!(y/n)")
            s = Game.input_handler()

        turn = turn+1
        print()

    if(Game.player.money >= 200):
        print(f"{Game.player.name} wins!")
elif s == "False":
    print("Okay, See you next time")

```

And here is the save/load system that isn't working at the moment. (Crashes the game)

```
@staticmethod
    def askSave():
        ask = input("Do you want to save?\n--> ").upper()
        if ask == "Y" or ask == "YES":
            # Saves the desired class AND a chosen attribute
            print(Game.player.name)

            Save = Player(Game.player.name)
            # Creates the file and puts the data into the file
            pickle.dump(Save, open("save.dat", "wb"))
            # The file doesn't have an extension because it is a binary file and makes it easier to parse.
        elif ask == "N" or ask == "NO":
            print("Okay, maybe next time!")
            return
        else:
            print("Sorry, that does not compute with me! Please try again!")
            Game.askSave()

    @staticmethod
    def load():
        me = pickle.load(open("save.dat", "rb"))  # Loads the file
    # Prints the stats out to verify the load has successfully happened
        me.display(Player.display)

```

I'm not sure honestly what the issue is.

For context, everytime the player says "save" and then "y" the game crashes completely and forces you to restart which is obviously not the intention, the same goes for the load system.