(self)
| 20 | |
| 21 | class Player: |
| 22 | def __init__(self): |
| 23 | while True: |
| 24 | print('请输入回放文件路径:', end='') |
| 25 | path = input() |
| 26 | if path[-5:] != '.json': |
| 27 | print('路径输入有误,请重试!') |
| 28 | continue |
| 29 | try: |
| 30 | self.data = json.load(open(path)) |
| 31 | break |
| 32 | except FileNotFoundError: |
| 33 | print('路径输入有误,请重试!') |
| 34 | |
| 35 | # 一个列表,元素为两个列表(代表双方**场上**Fish) |
| 36 | self.field = [[], []] |
| 37 | |
| 38 | def play(self): |
| 39 | f = open('replay.txt', 'w', encoding='utf-8') |