Skip to content
Snippets Groups Projects
Commit 8e3d61a9 authored by spiglerg's avatar spiglerg
Browse files

random generator with turns

parent e2c3a494
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,11 @@ transition_probability = [1.0, # empty cell - Case 0 ...@@ -17,7 +17,11 @@ transition_probability = [1.0, # empty cell - Case 0
0.5, # Case 4 - single slip 0.5, # Case 4 - single slip
0.5, # Case 5 - double slip 0.5, # Case 5 - double slip
0.2, # Case 6 - symmetrical 0.2, # Case 6 - symmetrical
0.0] # Case 7 - dead end 0.0, # Case 7 - dead end
0.2, # Case 8 - turn left
0.2, # Case 9 - turn right
1.0] # Case 10 - mirrored switch
""" """
# Example generate a random rail # Example generate a random rail
env = RailEnv(width=20, env = RailEnv(width=20,
......
...@@ -227,7 +227,7 @@ def generate_rail_from_list_of_manual_specifications(list_of_specifications) ...@@ -227,7 +227,7 @@ def generate_rail_from_list_of_manual_specifications(list_of_specifications)
""" """
def random_rail_generator(cell_type_relative_proportion=[1.0] * 8): def random_rail_generator(cell_type_relative_proportion=[1.0] * 11):
""" """
Dummy random level generator: Dummy random level generator:
- fill in cells at random in [width-2, height-2] - fill in cells at random in [width-2, height-2]
...@@ -266,7 +266,10 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 8): ...@@ -266,7 +266,10 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 8):
transitions_templates_ = [] transitions_templates_ = []
transition_probabilities = [] transition_probabilities = []
for i in range(len(t_utils.transitions) - 4): # don't include dead-ends for i in range(len(t_utils.transitions)): # don't include dead-ends
if t_utils.transitions[i] == int('0010000000000000', 2):
continue
all_transitions = 0 all_transitions = 0
for dir_ in range(4): for dir_ in range(4):
trans = t_utils.get_transitions(t_utils.transitions[i], dir_) trans = t_utils.get_transitions(t_utils.transitions[i], dir_)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment