Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/RandomMapGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def makeMap(
gap_h = 2

# 小マップのブロック, アイテムの数
small_block = [5, 8]
small_item = [6, 10]
small_block = [block_max - 3, block_max]
small_item = [item_max - 3, item_max]
# 隙間マップのブロック, アイテムの数
gap_block = [0, 3]
gap_item = [0, 4]
gap_item = [0, 3]

# 小マップの生成
small_map = np.zeros((small_h, small_w))
Expand All @@ -200,7 +200,7 @@ def outputMap(
) -> None:
if not os.path.exists(file_path):
os.makedirs(file_path)
with open(f"{file_path}{file_name}.map", "w") as f:
with open(f"{file_path}/{file_name}.map", "w") as f:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.join()で統一したい

Suggested change
with open(f"{file_path}/{file_name}.map", "w") as f:
with open(os.path.join(file_path,f"{file_name}.map"), "w") as f:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確かに!
修正します.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

アルゴリズムの関係上, このままの実装だと, argで渡された値と若干の乖離があるのは避けられないことなので諦めます.
ただ, argで渡された値/4は簡単に実装できると思うのでやってしまいます.
(追加する処理としては, argで渡された値/4で端数が出た場合は切り捨てして小さいランダムマップの生成処理をする)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f.write(f"N:generated{file_name}\n")
f.write(f"T:{time}\n")
f.write("S:15,17\n")
Expand Down