Skip to content

Commit

Permalink
randomize maze xml file name (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kallinteris-Andreas authored Oct 18, 2023
1 parent 3a579d6 commit 5a665ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gymnasium_robotics/envs/maze/maze_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""
import math
import tempfile
import time
import xml.etree.ElementTree as ET
from os import path
from typing import Dict, List, Optional, Union
Expand Down Expand Up @@ -235,7 +236,8 @@ def make_maze(

# Save new xml with maze to a temporary file
with tempfile.TemporaryDirectory() as tmp_dir:
temp_xml_path = path.join(path.dirname(tmp_dir), "ant_maze.xml")
temp_xml_name = f"ant_maze{str(time.time())}.xml"
temp_xml_path = path.join(path.dirname(tmp_dir), temp_xml_name)
tree.write(temp_xml_path)

return maze, temp_xml_path
Expand Down

0 comments on commit 5a665ab

Please sign in to comment.