Skip to content

Commit eb36691

Browse files
authored
Merge pull request #26 from yugu0202/develop
ログ方式の微小な修正
2 parents e27f50b + 599ca10 commit eb36691

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Logger.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ class Logger:
22
def __init__(self,log_path:str,map_path:str):
33
self.path = log_path
44
with open(map_path, mode="r") as f:
5-
data = "".join(list(map(lambda x: x[2:],f.readlines())))
6-
7-
with open(self.path, mode="w") as f:
8-
f.write(data);
5+
self.map_data = "".join(list(map(lambda x: x[2:],f.readlines())))
96

107
def set_name(self,cool_name:str,hot_name:str):
11-
with open(self.path,mode="a") as f:
12-
f.write(f"{cool_name},{hot_name}")
8+
with open(self.path,mode="w") as f:
9+
f.write(f"{cool_name},{hot_name}\n")
10+
f.write(self.map_data);
11+
f.write("0,0");
1312

1413
def action(self,map_data:str,cool_pos:str,hot_pos:str,cool_item:int,hot_item:int):
1514
with open(self.path,mode="a") as f:
@@ -30,4 +29,4 @@ def result(self,player:str,result:str,reason:str):
3029
else:
3130
with open(self.path,mode="a") as f:
3231
f.write("\ngameend")
33-
f.write(f"\n{result},{reason}")
32+
f.write(f"\n,{result},{reason}")

0 commit comments

Comments
 (0)