Skip to content

Commit

Permalink
fix(ai): add legacy policy support
Browse files Browse the repository at this point in the history
  • Loading branch information
Flecart committed Jul 31, 2022
1 parent 1028285 commit 65a29aa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions PyGame/orso_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,13 @@ def print_value(self, board):
print(f"{self.name}: {board.get_hash()} -> {self.states_value.get(board.get_hash())}")

def load_policy(self, file):
fr = open(file, 'rb')
data = pickle.load(fr)
self.states_value = data['states_value']
fr.close()
with open(file, 'rb') as file_read:
data = pickle.load(file_read)

self.states_value = (
data if 'states_value' not in data else # data legacy support
data['states_value']
)

# Main
if __name__ == "__main__":
Expand Down

0 comments on commit 65a29aa

Please sign in to comment.